1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +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) out, err := io.ReadAll(b)
assert.NoError(t, err) assert.NoError(t, err)
expected := ` expected := `
apiVersion: kyverno.io/v2beta1 apiVersion: kyverno.io/v2
kind: PolicyException kind: PolicyException
metadata: metadata:
name: test name: test
@ -72,7 +72,7 @@ func TestCommandWithAll(t *testing.T) {
out, err := io.ReadAll(b) out, err := io.ReadAll(b)
assert.NoError(t, err) assert.NoError(t, err)
expected := ` expected := `
apiVersion: kyverno.io/v2beta1 apiVersion: kyverno.io/v2
kind: PolicyException kind: PolicyException
metadata: metadata:
name: test name: test

View file

@ -1,4 +1,4 @@
apiVersion: kyverno.io/v2beta1 apiVersion: kyverno.io/v2
kind: PolicyException kind: PolicyException
metadata: metadata:
name: {{ .Name }} 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 { func NewCleanupPolicyEvent(policy kyvernov2beta1.CleanupPolicyInterface, resource unstructured.Unstructured, err error) Info {
regarding := corev1.ObjectReference{ regarding := corev1.ObjectReference{
// TODO: iirc it's not safe to assume api version is set // TODO: iirc it's not safe to assume api version is set
APIVersion: "kyverno.io/v2beta1", APIVersion: "kyverno.io/v2",
Kind: policy.GetKind(), Kind: policy.GetKind(),
Name: policy.GetName(), Name: policy.GetName(),
Namespace: policy.GetNamespace(), Namespace: policy.GetNamespace(),

View file

@ -26,7 +26,7 @@ func Test_Validate(t *testing.T) {
Enabled: false, Enabled: false,
Namespace: "kyverno", 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, want: 1,
}, },
@ -37,7 +37,7 @@ func Test_Validate(t *testing.T) {
Enabled: true, Enabled: true,
Namespace: "kyverno", 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, want: 1,
}, },
@ -48,7 +48,7 @@ func Test_Validate(t *testing.T) {
Enabled: true, Enabled: true,
Namespace: "kyverno", 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, want: 0,
}, },
@ -59,7 +59,7 @@ func Test_Validate(t *testing.T) {
Enabled: true, Enabled: true,
Namespace: "", 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, want: 0,
}, },

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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