1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-10 09:56:55 +00:00
kyverno/test/conformance/chainsaw/validate/e2e/adding-key-to-config-map/chainsaw-test.yaml

26 lines
927 B
YAML
Raw Normal View History

apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: adding-key-to-config-map
spec:
steps:
- name: step-01
try:
- apply:
file: chainsaw-step-01-apply-1-1.yaml
- apply:
file: chainsaw-step-01-apply-1-2.yaml
- apply:
file: chainsaw-step-01-apply-1-3.yaml
- assert:
file: chainsaw-step-01-assert-1-1.yaml
- name: step-02
try:
- script:
content: "if kubectl patch ConfigMap test-configmap -n test-validate-e2e-adding-key-to-config-map
--type='json' -p=\"[{\\\"op\\\": \\\"add\\\", \\\"path\\\": \\\"/data/lock\\\",
\\\"value\\\":\"\"admin\"\"}]\" 2>&1 | grep -q 'validation error: Configmap
key must be \"abc\"' \nthen \n echo \"Test succeeded. Resource was blocked
from adding key.\"\n exit 0\nelse \n echo \"Tested failed. Resource was
not blocked from adding key.\"\n exit 1 \nfi\n"