1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

chore: use v2 for exceptions in chainsaw tests (#10529)

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
This commit is contained in:
Mariam Fahmy 2024-06-24 18:54:57 +07:00 committed by GitHub
parent 585aff0aca
commit b7bf894fe9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 44 additions and 44 deletions

View file

@ -40,7 +40,7 @@ func TestCommandWithAny(t *testing.T) {
out, err := io.ReadAll(b)
assert.NoError(t, err)
expected := `
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: test
@ -72,7 +72,7 @@ func TestCommandWithAll(t *testing.T) {
out, err := io.ReadAll(b)
assert.NoError(t, err)
expected := `
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: test

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: {{ .Name }}

View file

@ -288,7 +288,7 @@ func NewPolicyExceptionEvents(engineResponse engineapi.EngineResponse, ruleResp
func NewCleanupPolicyEvent(policy kyvernov2beta1.CleanupPolicyInterface, resource unstructured.Unstructured, err error) Info {
regarding := corev1.ObjectReference{
// TODO: iirc it's not safe to assume api version is set
APIVersion: "kyverno.io/v2beta1",
APIVersion: "kyverno.io/v2",
Kind: policy.GetKind(),
Name: policy.GetName(),
Namespace: policy.GetNamespace(),

View file

@ -26,7 +26,7 @@ func Test_Validate(t *testing.T) {
Enabled: false,
Namespace: "kyverno",
},
resource: []byte(`{"apiVersion":"kyverno.io/v2beta1","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"delta"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
resource: []byte(`{"apiVersion":"kyverno.io/v2","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"delta"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
},
want: 1,
},
@ -37,7 +37,7 @@ func Test_Validate(t *testing.T) {
Enabled: true,
Namespace: "kyverno",
},
resource: []byte(`{"apiVersion":"kyverno.io/v2beta1","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"delta"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
resource: []byte(`{"apiVersion":"kyverno.io/v2","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"delta"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
},
want: 1,
},
@ -48,7 +48,7 @@ func Test_Validate(t *testing.T) {
Enabled: true,
Namespace: "kyverno",
},
resource: []byte(`{"apiVersion":"kyverno.io/v2beta1","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"kyverno"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
resource: []byte(`{"apiVersion":"kyverno.io/v2","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"kyverno"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
},
want: 0,
},
@ -59,7 +59,7 @@ func Test_Validate(t *testing.T) {
Enabled: true,
Namespace: "",
},
resource: []byte(`{"apiVersion":"kyverno.io/v2beta1","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"kyverno"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
resource: []byte(`{"apiVersion":"kyverno.io/v2","kind":"PolicyException","metadata":{"name":"enforce-label-exception","namespace":"kyverno"},"spec":{"exceptions":[{"policyName":"enforce-label","ruleNames":["enforce-label"]}],"match":{"any":[{"resources":{"kinds":["Pod"]}}]}}}`),
},
want: 0,
},

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: delta-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: container-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: mynewpolex

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: delta-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: polex-right

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: polex-wrong

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: container-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: policy-exception-allow-latest

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: failing-container-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: passing-container-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: mynewpolex

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: mynewpolex

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: policy-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: label-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: mynewpolex

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: container-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: pod-security-exception

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: mynewpolex

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: allow-scaling-nginx-test

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1
apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
name: allow-scaling-nginx-test