Skip to content

Commit 1c58e69

Browse files
bahkauv70Fyusel
authored andcommitted
fix: reset user directory for tests to avoid automatic lookup of real
keys during test
1 parent e3fcbdd commit 1c58e69

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/auth/auth_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ func TestKeyAuth(t *testing.T) {
503503
t.Setenv("STACKIT_SERVICE_ACCOUNT_KEY_PATH", "")
504504
t.Setenv("STACKIT_PRIVATE_KEY", "")
505505
t.Setenv("STACKIT_PRIVATE_KEY_PATH", "")
506+
t.Setenv("HOME", t.TempDir())
506507

507508
var saKey string
508509
if test.serviceAccountKey != nil {
@@ -843,6 +844,7 @@ func TestGetServiceAccountKey(t *testing.T) {
843844
},
844845
} {
845846
t.Run(test.name, func(t *testing.T) {
847+
t.Setenv("HOME", t.TempDir())
846848
t.Setenv("STACKIT_CREDENTIALS_PATH", test.credentialsFilePath)
847849

848850
if test.envServiceAccountKeyPathSet {

0 commit comments

Comments
 (0)