Skip to content

Commit a764d67

Browse files
committed
fix: Add review findings
1 parent 1e22875 commit a764d67

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

core/auth/auth_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,17 @@ func TestKeyAuth(t *testing.T) {
456456
configuredPrivateKey: string(configuredPrivateKey),
457457
expectedPrivateKey: string(configuredPrivateKey),
458458
isValid: true,
459+
homeDir: func(t *testing.T) string { return t.TempDir() },
460+
459461
},
460462
{
461463
desc: "included_private_key",
462464
serviceAccountKey: fixtureServiceAccountKey(),
463465
includedPrivateKey: &includedPrivateKey,
464466
expectedPrivateKey: includedPrivateKey,
465467
isValid: true,
468+
homeDir: func(t *testing.T) string { return t.TempDir() },
469+
466470
},
467471
{
468472
desc: "empty_configured_use_included_private_key",
@@ -471,6 +475,8 @@ func TestKeyAuth(t *testing.T) {
471475
configuredPrivateKey: "",
472476
expectedPrivateKey: includedPrivateKey,
473477
isValid: true,
478+
homeDir: func(t *testing.T) string { return t.TempDir() },
479+
474480
},
475481
{
476482
desc: "configured_over_included_private_key",
@@ -479,6 +485,8 @@ func TestKeyAuth(t *testing.T) {
479485
configuredPrivateKey: configuredPrivateKey,
480486
expectedPrivateKey: configuredPrivateKey,
481487
isValid: true,
488+
homeDir: func(t *testing.T) string { return t.TempDir() },
489+
482490
},
483491
{
484492
desc: "no_sa_key",
@@ -492,6 +500,7 @@ func TestKeyAuth(t *testing.T) {
492500
serviceAccountKey: fixtureServiceAccountKey(),
493501
configuredPrivateKey: "",
494502
isValid: false,
503+
homeDir: func(t *testing.T) string { return t.TempDir() },
495504
},
496505
{
497506
desc: "no_keys",
@@ -790,6 +799,7 @@ func TestGetServiceAccountKey(t *testing.T) {
790799
},
791800
wantErr: false,
792801
expectedKey: "key",
802+
userHomeDir: func(t *testing.T) string { return t.TempDir() },
793803
},
794804
{
795805
name: "cfg_sa_key_path",
@@ -798,20 +808,23 @@ func TestGetServiceAccountKey(t *testing.T) {
798808
},
799809
wantErr: false,
800810
expectedKey: "key",
811+
userHomeDir: func(t *testing.T) string { return t.TempDir() },
801812
},
802813
{
803814
name: "env_sa_key_path",
804815
cfg: &config.Configuration{},
805816
envServiceAccountKeyPathSet: true,
806817
wantErr: false,
807818
expectedKey: "key",
819+
userHomeDir: func(t *testing.T) string { return t.TempDir() },
808820
},
809821
{
810822
name: "credentials_file_sa_key_path",
811823
cfg: &config.Configuration{},
812824
credentialsFilePath: "test_resources/test_credentials_foo.json",
813825
wantErr: false,
814826
expectedKey: "foo_key",
827+
userHomeDir: func(t *testing.T) string { return t.TempDir() },
815828
},
816829
{
817830
name: "cfg_sa_key_precedes_path",
@@ -821,6 +834,7 @@ func TestGetServiceAccountKey(t *testing.T) {
821834
},
822835
wantErr: false,
823836
expectedKey: "cfg_key",
837+
userHomeDir: func(t *testing.T) string { return t.TempDir() },
824838
},
825839
{
826840
name: "cfg_sa_key_precedes_env",
@@ -830,6 +844,7 @@ func TestGetServiceAccountKey(t *testing.T) {
830844
envServiceAccountKeyPathSet: true,
831845
wantErr: false,
832846
expectedKey: "cfg_key",
847+
userHomeDir: func(t *testing.T) string { return t.TempDir() },
833848
},
834849
{
835850
name: "cfg_sa_key_precedes_creds_file",
@@ -839,13 +854,15 @@ func TestGetServiceAccountKey(t *testing.T) {
839854
credentialsFilePath: "test_resources/test_credentials_foo.json",
840855
wantErr: false,
841856
expectedKey: "cfg_key",
857+
userHomeDir: func(t *testing.T) string { return t.TempDir() },
842858
},
843859
{
844860
name: "env_sa_key_precedes_creds_file",
845861
cfg: &config.Configuration{},
846862
envServiceAccountKeyPathSet: true,
847863
credentialsFilePath: "test_resources/test_credentials_foo.json",
848864
wantErr: false,
865+
userHomeDir: func(t *testing.T) string { return t.TempDir() },
849866
expectedKey: "key",
850867
},
851868
{

0 commit comments

Comments
 (0)