Skip to content

Commit

Permalink
chore: add a failing scenario
Browse files Browse the repository at this point in the history
Signed-off-by: Shahram Kalantari <[email protected]>
  • Loading branch information
shahramk64 committed Dec 30, 2024
1 parent cf5b5b7 commit 068198c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/bats/base-test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ RATIFY_NAMESPACE=gatekeeper-system
touch notation-file2.crt
echo "fake cert 3" > notation-file3.crt

# Happy path:
# Capture Helm template output
rendered=$(helm template multiple-trust-policies ./charts/ratify \
--set featureFlags.RATIFY_CERT_ROTATION=true \
Expand Down Expand Up @@ -147,6 +148,26 @@ EOF
echo "$expected_verifier_notation"
return 1
}

# failure path:
# Capture Helm template output
run helm template multiple-trust-policies ./charts/ratify \
--set featureFlags.RATIFY_CERT_ROTATION=true \
--set-file notationCerts[0]="notation-file1.crt" \
--set notation.trustPolicies[0].registryScopes[0]="registry1.azurecr.io/" \
--set notation.trustPolicies[0].trustedIdentities[0]="cert identity 1" \
--set notation.trustPolicies[0].trustStores[0]=ca:unknownCert

assert_failure

# the expected error message
expected_verifier_notation=$(cat <<EOF
Unknown trust store reference: unknownCert
EOF
)

# Assert that the rendered Helm output contains the expected error message
[[ "$output" == *"$expected_verifier_notation"* ]]
}

@test "crd version test" {
Expand Down

0 comments on commit 068198c

Please sign in to comment.