From 6f6828a71fbc77af6a24e0e40b0428de8fc50c44 Mon Sep 17 00:00:00 2001 From: "Zachary J. Rollyson" Date: Fri, 13 Dec 2024 17:12:45 -0500 Subject: [PATCH] fix: clear tested env vars before testing creds.go See issue #67 --- runner/cf-executor/cg/creds_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runner/cf-executor/cg/creds_test.go b/runner/cf-executor/cg/creds_test.go index 813bee7..153bb47 100644 --- a/runner/cf-executor/cg/creds_test.go +++ b/runner/cf-executor/cg/creds_test.go @@ -74,6 +74,15 @@ func Test_getCreds(t *testing.T) { }, } + // Todo (zjrgov): it could also make sense to get ENV vars outside this + // code, but I'm not exactly sure what the end implementation will look + // like and don't want to get ahead of myself. + // + // See https://github.com/GSA-TTS/gitlab-runner-cloudgov/issues/67 + for _, k := range []string{"CF_USERNAME", "CF_PASSWORD", "VCAP_SERVICES"} { + t.Setenv(k, "") + } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { for key, val := range tt.env {