1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 07:57:07 +00:00
kyverno/test/conformance/chainsaw/flags/standard/emit-events/chainsaw-test.yaml
Mariam Fahmy 90ac90b89f
feat: use the check block for checking CLI output in chainsaw tests (#9616)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2024-02-05 14:59:19 +00:00

41 lines
954 B
YAML
Executable file

apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: emit-events
spec:
steps:
- name: step-01
try:
- apply:
file: admission-controller.yaml
- assert:
file: admission-controller-assert.yaml
- name: step-02
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: step-03
try:
- apply:
file: resource.yaml
- apply:
expect:
- check:
($error != null): true
file: resource-fail.yaml
- name: step-04
try:
- apply:
file: event-assert.yaml
- name: step-05
try:
- script:
content: kubectl logs deployment/kyverno-admission-controller -n kyverno
check:
# This check ensures that the string 'reason="PolicyViolation"' is found
# in stdout or else fails
(contains($stdout, 'reason=\"PolicyViolation\"')): true