# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
  name: fetch-pod-resource
spec:
  steps:
  - name: create policy
    try:
    - create:
        file: policy.yaml
    - sleep:
        duration: 10s
  - name: create pod
    try:
    - create:
        file: pod.yaml
  - name: create positive deployment
    try:
    - create:
        file: positive.yaml
  - name: create negative deployment
    try:
    - create:
        file: negative.yaml
        expect:
          - check:
              ($error): >-
                admission webhook "vpol.validate.kyverno.svc-fail" denied the request: Policy check-deployment-labels failed: Deployment labels must be env=prod