Skip to content

Commit

Permalink
test(k8s): ignore scw env variable in exec-credentials tests
Browse files Browse the repository at this point in the history
These tests create their own profiles to test how env is loaded. We must ignore env variables that are used to run the tests as they collide with test's profiles
  • Loading branch information
Codelax committed Dec 17, 2024
1 parent 14a3c8c commit 6266c7b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/namespaces/k8s/v1/custom_execcredentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ func Test_ExecCredential(t *testing.T) {
TmpHomeDir: true,
BeforeFunc: beforeFuncCreateFullConfig(),
Cmd: "scw k8s exec-credential",
OverrideEnv: map[string]string{
scw.ScwAccessKeyEnv: "", // Ignore keys in test env
scw.ScwSecretKeyEnv: "", // Ignore keys in test env
},
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
Expand Down Expand Up @@ -57,6 +61,8 @@ func Test_ExecCredential(t *testing.T) {
Cmd: "scw k8s exec-credential",
OverrideEnv: map[string]string{
scw.ScwActiveProfileEnv: "p2",
scw.ScwAccessKeyEnv: "", // Ignore keys in test env
scw.ScwSecretKeyEnv: "", // Ignore keys in test env
},
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
Expand All @@ -71,6 +77,10 @@ func Test_ExecCredential(t *testing.T) {
TmpHomeDir: true,
BeforeFunc: beforeFuncCreateFullConfig(),
Cmd: "scw --profile p3 k8s exec-credential",
OverrideEnv: map[string]string{
scw.ScwAccessKeyEnv: "", // Ignore keys in test env
scw.ScwSecretKeyEnv: "", // Ignore keys in test env
},
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
core.TestCheckGolden(),
Expand All @@ -86,6 +96,8 @@ func Test_ExecCredential(t *testing.T) {
Cmd: "scw --profile p3 k8s exec-credential",
OverrideEnv: map[string]string{
scw.ScwActiveProfileEnv: "p2",
scw.ScwAccessKeyEnv: "", // Ignore keys in test env
scw.ScwSecretKeyEnv: "", // Ignore keys in test env
},
Check: core.TestCheckCombine(
core.TestCheckExitCode(0),
Expand Down

0 comments on commit 6266c7b

Please sign in to comment.