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

fix: api call chainsaw tests (#11682)

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
This commit is contained in:
Vishal Choudhary 2024-12-02 21:16:37 +05:30 committed by GitHub
parent d215ce5344
commit ec658b7abf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 31 deletions

View file

@ -4,10 +4,6 @@ metadata:
name: default name: default
spec: spec:
steps: steps:
- name: step-01
try:
- apply:
file: ns-bad.yaml
- name: create policy - name: create policy
use: use:
template: ../../../../../_step-templates/create-policy.yaml template: ../../../../../_step-templates/create-policy.yaml

View file

@ -1,4 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: not-default

View file

@ -1,9 +1,8 @@
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: example name: bad-pod
namespace: default
spec: spec:
containers: containers:
- image: nginx:latest - image: nginx
name: example name: example

View file

@ -2,7 +2,6 @@ apiVersion: v1
kind: Pod kind: Pod
metadata: metadata:
name: example name: example
namespace: default
spec: spec:
containers: containers:
- image: nginx:latest - image: nginx:latest

View file

@ -12,31 +12,27 @@ spec:
- Pod - Pod
operations: operations:
- CREATE - CREATE
- UPDATE
context: context:
- name: testString - name: podname
apiCall: apiCall:
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid" urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
jmesPath: metadata.name jmesPath: metadata.name
default: default default: example
- name: testJSON - name: testJSON
apiCall: apiCall:
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid" urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
default: '{"metadata": {"name": "default"}}' default:
- name: testInteger metadata:
apiCall: name: example
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
jmesPath: metadata.resourceVersion
default: 1
validate: validate:
failureAction: Enforce
deny: deny:
conditions: conditions:
all: all:
- key: "{{ testString }}" - key: "{{ podname }}"
operator: Equals operator: NotEquals
value: "{{ request.namespace }}" value: "{{ request.object.metadata.name }}"
- key: "{{ testJSON.metadata.name }}" - key: "{{ testJSON.metadata.name }}"
operator: Equals operator: NotEquals
value: "{{ request.namespace }}" value: "{{ request.object.metadata.name }}"
- key: "{{ testInteger }}"
operator: GreaterThan
value: 2