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:
parent
d215ce5344
commit
ec658b7abf
5 changed files with 17 additions and 31 deletions
|
@ -4,10 +4,6 @@ metadata:
|
|||
name: default
|
||||
spec:
|
||||
steps:
|
||||
- name: step-01
|
||||
try:
|
||||
- apply:
|
||||
file: ns-bad.yaml
|
||||
- name: create policy
|
||||
use:
|
||||
template: ../../../../../_step-templates/create-policy.yaml
|
||||
|
@ -32,4 +28,4 @@ spec:
|
|||
expect:
|
||||
- check:
|
||||
($error != null): true
|
||||
file: pod-bad.yaml
|
||||
file: pod-bad.yaml
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: not-default
|
|
@ -1,9 +1,8 @@
|
|||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: example
|
||||
namespace: default
|
||||
name: bad-pod
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:latest
|
||||
name: example
|
||||
- image: nginx
|
||||
name: example
|
||||
|
|
|
@ -2,8 +2,7 @@ apiVersion: v1
|
|||
kind: Pod
|
||||
metadata:
|
||||
name: example
|
||||
namespace: default
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:latest
|
||||
name: example
|
||||
name: example
|
||||
|
|
|
@ -12,31 +12,27 @@ spec:
|
|||
- Pod
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
context:
|
||||
- name: testString
|
||||
- name: podname
|
||||
apiCall:
|
||||
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
|
||||
jmesPath: metadata.name
|
||||
default: default
|
||||
default: example
|
||||
- name: testJSON
|
||||
apiCall:
|
||||
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
|
||||
default: '{"metadata": {"name": "default"}}'
|
||||
- name: testInteger
|
||||
apiCall:
|
||||
urlPath: "/api/v1/namespaces/{{ request.namespace }}/invalid"
|
||||
jmesPath: metadata.resourceVersion
|
||||
default: 1
|
||||
default:
|
||||
metadata:
|
||||
name: example
|
||||
validate:
|
||||
failureAction: Enforce
|
||||
deny:
|
||||
conditions:
|
||||
all:
|
||||
- key: "{{ testString }}"
|
||||
operator: Equals
|
||||
value: "{{ request.namespace }}"
|
||||
- key: "{{ podname }}"
|
||||
operator: NotEquals
|
||||
value: "{{ request.object.metadata.name }}"
|
||||
- key: "{{ testJSON.metadata.name }}"
|
||||
operator: Equals
|
||||
value: "{{ request.namespace }}"
|
||||
- key: "{{ testInteger }}"
|
||||
operator: GreaterThan
|
||||
value: 2
|
||||
operator: NotEquals
|
||||
value: "{{ request.object.metadata.name }}"
|
||||
|
|
Loading…
Reference in a new issue