1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-28 02:18:15 +00:00

chore: convert chainsaw tests to Test resource (#9094)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-12-06 17:27:10 +01:00 committed by GitHub
parent e1eb9f6cdb
commit 4a557ba2cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 284 additions and 452 deletions

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: resource
spec:
timeouts: {}
try:
- apply:
file: resource.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: event
spec:
timeouts: {}
try:
- assert:
file: background-event.yaml
- error:
file: admission-event.yaml

View file

@ -0,0 +1,23 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: no-admission-event
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: step-02
try:
- apply:
file: resource.yaml
- name: step-03
try:
- assert:
file: background-event.yaml
- error:
file: admission-event.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: resource
spec:
timeouts: {}
try:
- apply:
file: resource.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: report
spec:
timeouts: {}
try:
- error:
file: admission-report.yaml

View file

@ -0,0 +1,21 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: no-admission-report
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: step-02
try:
- apply:
file: resource.yaml
- name: step-03
try:
- error:
file: admission-report.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: resource
spec:
timeouts: {}
try:
- apply:
file: resource.yaml

View file

@ -0,0 +1,17 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: not-rejected
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: step-02
try:
- apply:
file: resource.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: resource
spec:
timeouts: {}
try:
- apply:
file: resource.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: event
spec:
timeouts: {}
try:
- assert:
file: background-event.yaml
- error:
file: admission-event.yaml

View file

@ -0,0 +1,23 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: no-admission-event
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: step-02
try:
- apply:
file: resource.yaml
- name: step-03
try:
- assert:
file: background-event.yaml
- error:
file: admission-event.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: resource
spec:
timeouts: {}
try:
- apply:
file: resource.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: report
spec:
timeouts: {}
try:
- error:
file: admission-report.yaml

View file

@ -0,0 +1,21 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: no-admission-report
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: step-02
try:
- apply:
file: resource.yaml
- name: step-03
try:
- error:
file: admission-report.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: resource
spec:
timeouts: {}
try:
- apply:
file: resource.yaml

View file

@ -0,0 +1,17 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: not-rejected
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy-assert.yaml
- name: step-02
try:
- apply:
file: resource.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: rbac
spec:
timeouts: {}
try:
- apply:
file: rbac.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: pod
spec:
timeouts: {}
try:
- apply:
file: pod.yaml
- assert:
file: pod-assert.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: sleep
spec:
timeouts: {}
try:
- sleep:
duration: 65s

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: check
spec:
timeouts: {}
try:
- error:
file: pod-assert.yaml

View file

@ -0,0 +1,31 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: cleanup-pod
spec:
steps:
- name: step-01
try:
- apply:
file: rbac.yaml
- name: step-02
try:
- apply:
file: pod.yaml
- assert:
file: pod-assert.yaml
- name: step-03
try:
- apply:
file: policy.yaml
- assert:
file: policy.yaml
- name: step-04
try:
- sleep:
duration: 1m5s
- name: step-05
try:
- error:
file: pod-assert.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: rbac
spec:
timeouts: {}
try:
- apply:
file: rbac.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: pod
spec:
timeouts: {}
try:
- apply:
file: pod.yaml
- assert:
file: pod-assert.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: sleep
spec:
timeouts: {}
try:
- sleep:
duration: 5s

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: check
spec:
timeouts: {}
try:
- error:
file: pod-assert.yaml

View file

@ -0,0 +1,31 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: context-cleanup-pod
spec:
steps:
- name: step-01
try:
- apply:
file: rbac.yaml
- name: step-02
try:
- apply:
file: pod.yaml
- assert:
file: pod-assert.yaml
- name: step-03
try:
- apply:
file: policy.yaml
- assert:
file: policy.yaml
- name: step-04
try:
- sleep:
duration: 5s
- name: step-05
try:
- error:
file: pod-assert.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: rbac
spec:
timeouts: {}
try:
- apply:
file: rbac.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: pod
spec:
timeouts: {}
try:
- apply:
file: pod.yaml
- assert:
file: pod-assert.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy.yaml

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: sleep
spec:
timeouts: {}
try:
- sleep:
duration: 65s

View file

@ -1,11 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: check
spec:
timeouts: {}
try:
- error:
file: pod-assert.yaml

View file

@ -0,0 +1,31 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: cleanup-pod
spec:
steps:
- name: step-01
try:
- apply:
file: rbac.yaml
- name: step-02
try:
- apply:
file: pod.yaml
- assert:
file: pod-assert.yaml
- name: step-03
try:
- apply:
file: policy.yaml
- assert:
file: policy.yaml
- name: step-04
try:
- sleep:
duration: 1m5s
- name: step-05
try:
- error:
file: pod-assert.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: policy
spec:
timeouts: {}
try:
- apply:
file: policy.yaml
- assert:
file: policy.yaml

View file

@ -1,13 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: clusterpolicy
spec:
timeouts: {}
try:
- apply:
file: clusterpolicy.yaml
- assert:
file: clusterpolicy.yaml

View file

@ -1,14 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: invalidpolicy
spec:
timeouts: {}
try:
- apply:
expect:
- check:
($error != null): true
file: invalidpolicy.yaml

View file

@ -0,0 +1,26 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: cron-format
spec:
steps:
- name: step-01
try:
- apply:
file: policy.yaml
- assert:
file: policy.yaml
- name: step-02
try:
- apply:
file: clusterpolicy.yaml
- assert:
file: clusterpolicy.yaml
- name: step-03
try:
- apply:
expect:
- check:
($error != null): true
file: invalidpolicy.yaml

View file

@ -1,24 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: cleanuppolicy
spec:
timeouts: {}
try:
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-subjects.yaml
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-roles.yaml
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-clusterroles.yaml

View file

@ -0,0 +1,24 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: no-user-info-in-match
spec:
steps:
- name: step-01
try:
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-subjects.yaml
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-roles.yaml
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-clusterroles.yaml

View file

@ -1,19 +0,0 @@
---
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
creationTimestamp: null
name: cleanup-policy
spec:
timeouts: {}
try:
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-image-registry.yaml
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-configmap.yaml

View file

@ -0,0 +1,19 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: not-supported-attributes-in-context
spec:
steps:
- name: step-01
try:
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-image-registry.yaml
- apply:
expect:
- check:
($error != null): true
file: cleanuppolicy-with-configmap.yaml