Skip to content

Commit

Permalink
Add missing logger initialisation, fixing panic throw during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewJohn committed Jun 13, 2024
1 parent 912ea6d commit f8eb79d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/param_parsing/environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package param_parsing
import (
"os"
"testing"

"github.com/warrensbox/terraform-switcher/lib"
)

func TestGetParamsFromEnvironment_version_from_env(t *testing.T) {
logger = lib.InitLogger("DEBUG")
var params Params
expected := "1.0.0_from_env"
_ = os.Setenv("TF_VERSION", expected)
Expand All @@ -18,6 +21,7 @@ func TestGetParamsFromEnvironment_version_from_env(t *testing.T) {
}

func TestGetParamsFromEnvironment_product_from_env(t *testing.T) {
logger = lib.InitLogger("DEBUG")
var params Params
expected := "opentofu"
_ = os.Setenv("TF_PRODUCT", expected)
Expand Down
1 change: 1 addition & 0 deletions lib/param_parsing/parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func checkExpectedPrecedenceVersion(t *testing.T, expectedVersion string) {
}

func TestGetParameters_check_config_precedence(t *testing.T) {
logger = lib.InitLogger("DEBUG")
t.Cleanup(func() {
getopt.CommandLine = getopt.New()
})
Expand Down

0 comments on commit f8eb79d

Please sign in to comment.