Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
viveklak committed Apr 6, 2022
1 parent e761ace commit 917c38a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/sdk/nodejs/examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,17 +501,26 @@ func TestHelmReleaseNamespace(t *testing.T) {
}

func TestHelmReleaseRedis(t *testing.T) {
expectKeyringInput := func(expectKeyRing bool) func(t *testing.T, stackInfo integration.RuntimeValidationStackInfo) {
expectKeyringInput := func(verifyVal bool, keyRingNonEmpty bool) func(t *testing.T,
stackInfo integration.RuntimeValidationStackInfo) {
// Validate that the keyring is omitted when verify is false/unspecified.
// https://github.com/pulumi/pulumi-kubernetes/issues/1959
return func(t *testing.T, stackInfo integration.RuntimeValidationStackInfo) {
seen := false
for _, res := range stackInfo.Deployment.Resources {
if res.Type == "kubernetes:helm.sh/v3:Release" {
seen = true
if expectKeyRing {
assert.Contains(t, res.Inputs, "keyring")

assert.Contains(t, res.Inputs, "verify")
verify := res.Inputs["verify"].(bool)
assert.Equal(t, verifyVal, verify)
val := res.Inputs["keyring"]
if keyRingNonEmpty {
assert.NotEmpty(t, val)
} else {
assert.NotContains(t, res.Inputs, "keyring")
assert.Empty(t, val)
}

}
}
assert.True(t, seen)
Expand All @@ -532,10 +541,10 @@ func TestHelmReleaseRedis(t *testing.T) {
Additive: true,
// The redis chart isn't signed so can't find provenance file for it.
// TODO: Add a separate test for chart verification.
ExtraRuntimeValidation: expectKeyringInput(false),
ExtraRuntimeValidation: expectKeyringInput(false, false),
},
},
ExtraRuntimeValidation: expectKeyringInput(false),
ExtraRuntimeValidation: expectKeyringInput(false, false),
})

integration.ProgramTest(t, &test)
Expand Down

0 comments on commit 917c38a

Please sign in to comment.