Skip to content

Commit

Permalink
updating test for multiple key-values in json secret
Browse files Browse the repository at this point in the history
  • Loading branch information
aircraft-cerier committed Feb 18, 2021
1 parent 387e660 commit 8fc6b09
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ func TestMain(t *testing.T) {
tests := []struct {
description string
envKey string
secretKey string
envValue string
secretValue string
secretMap map[string]string
expect string
json bool
callsSM bool
Expand Down Expand Up @@ -83,12 +82,14 @@ func TestMain(t *testing.T) {
envKey: "TEST",
envValue: "sm://<secret-path>",
expect: "sm://<secret-path>",
secretKey: "password",
secretValue: "secret",
json: true,
callsSM: true,
secretMap: map[string]string{
"user": "test",
"password": "secret",
},
json: true,
callsSM: true,
smOutput: &secretsmanager.GetSecretValueOutput{
SecretString: aws.String("{\"password\": \"secret\"}"),
SecretString: aws.String("{\"user\": \"test\",\"password\": \"secret\"}"),
},
},
}
Expand Down Expand Up @@ -136,8 +137,10 @@ func TestMain(t *testing.T) {
if got, want := os.Getenv(tc.envKey), tc.expect; got != want {
t.Errorf("\ngot: %s\nwanted: %s", got, want)
}
if got, want := os.Getenv(tc.secretKey), tc.secretValue; got != want {
t.Errorf("\ngot: %s\nwanted: %s", got, want)
for secretKey, secretValue := range tc.secretMap {
if got, want := os.Getenv(secretKey), secretValue; got != want {
t.Errorf("\ngot: %s\nwanted: %s", got, want)
}
}
}
})
Expand Down

0 comments on commit 8fc6b09

Please sign in to comment.