From 6266c7b544a6cfe8166c43883e42de259cfc3142 Mon Sep 17 00:00:00 2001 From: Jules Casteran Date: Tue, 17 Dec 2024 14:34:45 +0100 Subject: [PATCH] test(k8s): ignore scw env variable in exec-credentials tests 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 --- .../namespaces/k8s/v1/custom_execcredentials_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/namespaces/k8s/v1/custom_execcredentials_test.go b/internal/namespaces/k8s/v1/custom_execcredentials_test.go index 217b042344..6637ffa971 100644 --- a/internal/namespaces/k8s/v1/custom_execcredentials_test.go +++ b/internal/namespaces/k8s/v1/custom_execcredentials_test.go @@ -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(), @@ -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), @@ -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(), @@ -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),