1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-30 19:35:06 +00:00

test: add test to cleanup the same resource twice (#7965)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-08-03 18:49:34 +02:00 committed by GitHub
parent 64a555a25d
commit e9c8a3da0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- pod.yaml
assert:
- pod-assert.yaml

View file

@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
error:
- pod-assert.yaml

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- pod.yaml
assert:
- pod-assert.yaml

View file

@ -0,0 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
error:
- pod-assert.yaml

View file

@ -0,0 +1,10 @@
# ## Description
This test cleans up pods via a label assignment named `cleanup.kyverno.io/ttl: 10s`.
Once deleted, the pod is created a second time and we expect to be deleted again.
## Expected Behavior
The pod `test-pod` is cleaned up successfully after 10s twice.
## Reference Issue(s)

View file

@ -0,0 +1,6 @@
apiVersion: v1
kind: Pod
metadata:
name: test-pod
labels:
cleanup.kyverno.io/ttl: 10s

View file

@ -0,0 +1,10 @@
apiVersion: v1
kind: Pod
metadata:
name: test-pod
labels:
cleanup.kyverno.io/ttl: 10s
spec:
containers:
- image: nginx:latest
name: nginx