mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 07:57:07 +00:00
41 lines
954 B
YAML
Executable file
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
|
|
|