From 9d81549b8a88d6e84637dbdedaa9363326507ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Mon, 13 Mar 2023 14:17:16 +0100 Subject: [PATCH] test: clean a couple kuttl tests (#6553) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- .../audit/configmap-context-lookup/99-cleanup.yaml | 4 ---- .../api-initiated-pod-eviction/99-cleanup.yaml | 6 ------ .../block-pod-exec-requests/99-cleanup.yaml | 6 ------ .../bypass-with-policy-exception/99-cleanup.yaml | 7 ------- .../enforce/resource-apply-block/02-resource.yaml | 5 +++++ .../enforce/resource-apply-block/02-script.yaml | 14 -------------- .../enforce/resource-apply-block/99-cleanup.yaml | 4 ---- .../scaling-with-kubectl-scale/99-cleanup.yaml | 6 ------ .../e2e/adding-key-to-config-map/99-cleanup.yaml | 6 ------ .../e2e/lowercase-kind-crd/02-resource.yaml | 5 +++++ .../validate/e2e/lowercase-kind-crd/02-script.yaml | 12 ------------ .../e2e/lowercase-kind-crd/99-cleanup.yaml | 7 ------- 12 files changed, 10 insertions(+), 72 deletions(-) delete mode 100644 test/conformance/kuttl/validate/clusterpolicy/standard/audit/configmap-context-lookup/99-cleanup.yaml delete mode 100644 test/conformance/kuttl/validate/clusterpolicy/standard/enforce/api-initiated-pod-eviction/99-cleanup.yaml delete mode 100644 test/conformance/kuttl/validate/clusterpolicy/standard/enforce/block-pod-exec-requests/99-cleanup.yaml delete mode 100644 test/conformance/kuttl/validate/clusterpolicy/standard/enforce/bypass-with-policy-exception/99-cleanup.yaml create mode 100644 test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/02-resource.yaml delete mode 100644 test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/02-script.yaml delete mode 100644 test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/99-cleanup.yaml delete mode 100644 test/conformance/kuttl/validate/clusterpolicy/standard/enforce/scaling-with-kubectl-scale/99-cleanup.yaml delete mode 100644 test/conformance/kuttl/validate/e2e/adding-key-to-config-map/99-cleanup.yaml create mode 100644 test/conformance/kuttl/validate/e2e/lowercase-kind-crd/02-resource.yaml delete mode 100644 test/conformance/kuttl/validate/e2e/lowercase-kind-crd/02-script.yaml delete mode 100644 test/conformance/kuttl/validate/e2e/lowercase-kind-crd/99-cleanup.yaml diff --git a/test/conformance/kuttl/validate/clusterpolicy/standard/audit/configmap-context-lookup/99-cleanup.yaml b/test/conformance/kuttl/validate/clusterpolicy/standard/audit/configmap-context-lookup/99-cleanup.yaml deleted file mode 100644 index 61b7555976..0000000000 --- a/test/conformance/kuttl/validate/clusterpolicy/standard/audit/configmap-context-lookup/99-cleanup.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl delete -f 01-manifests.yaml,02-goodpod.yaml --force --wait=true --ignore-not-found=true \ No newline at end of file diff --git a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/api-initiated-pod-eviction/99-cleanup.yaml b/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/api-initiated-pod-eviction/99-cleanup.yaml deleted file mode 100644 index 0a7469d0cc..0000000000 --- a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/api-initiated-pod-eviction/99-cleanup.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl delete pod nginx -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete cpol deny-evict-by-pod-label -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete ns test-validate --force --ignore-not-found=true \ No newline at end of file diff --git a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/block-pod-exec-requests/99-cleanup.yaml b/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/block-pod-exec-requests/99-cleanup.yaml deleted file mode 100644 index e9f231d278..0000000000 --- a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/block-pod-exec-requests/99-cleanup.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl delete pod nginx -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete cpol deny-exec-by-pod-label -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete ns test-validate --force --ignore-not-found=true \ No newline at end of file diff --git a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/bypass-with-policy-exception/99-cleanup.yaml b/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/bypass-with-policy-exception/99-cleanup.yaml deleted file mode 100644 index 17a829a94d..0000000000 --- a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/bypass-with-policy-exception/99-cleanup.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl delete deploy nginx-test -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete polex allow-scaling-nginx-test -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete cpol nginx-test-scaling-policy -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete ns test-validate --force --ignore-not-found=true \ No newline at end of file diff --git a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/02-resource.yaml b/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/02-resource.yaml new file mode 100644 index 0000000000..b2edcffef7 --- /dev/null +++ b/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/02-resource.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +apply: +- file: resource.yaml + shouldFail: true diff --git a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/02-script.yaml b/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/02-script.yaml deleted file mode 100644 index 7580344147..0000000000 --- a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/02-script.yaml +++ /dev/null @@ -1,14 +0,0 @@ -## Checks that the manifests.yaml file CANNOT be successfully created. If it can, fail the test as this is incorrect. - -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: -- script: | - if kubectl apply -f resource.yaml - then - echo "Tested failed. Resource was allowed." - exit 1 - else - echo "Test succeeded. Resource was blocked." - exit 0 - fi \ No newline at end of file diff --git a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/99-cleanup.yaml b/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/99-cleanup.yaml deleted file mode 100644 index 15c3c49051..0000000000 --- a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/resource-apply-block/99-cleanup.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl delete -f 01-manifests.yaml --force --wait=true --ignore-not-found=true \ No newline at end of file diff --git a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/scaling-with-kubectl-scale/99-cleanup.yaml b/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/scaling-with-kubectl-scale/99-cleanup.yaml deleted file mode 100644 index bb1e136044..0000000000 --- a/test/conformance/kuttl/validate/clusterpolicy/standard/enforce/scaling-with-kubectl-scale/99-cleanup.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl delete deploy nginx-test -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete cpol nginx-test-scaling-policy -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete ns test-validate --force --ignore-not-found=true \ No newline at end of file diff --git a/test/conformance/kuttl/validate/e2e/adding-key-to-config-map/99-cleanup.yaml b/test/conformance/kuttl/validate/e2e/adding-key-to-config-map/99-cleanup.yaml deleted file mode 100644 index f115a929cc..0000000000 --- a/test/conformance/kuttl/validate/e2e/adding-key-to-config-map/99-cleanup.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl delete ConfigMap test-configmap -n test-validate-e2e-adding-key-to-config-map --force --wait=true --ignore-not-found=true - - command: kubectl delete pol configmap-policy -n test-validate-e2e-adding-key-to-config-map --force --wait=true --ignore-not-found=true - - command: kubectl delete ns test-validate-e2e-adding-key-to-config-map --force --ignore-not-found=true \ No newline at end of file diff --git a/test/conformance/kuttl/validate/e2e/lowercase-kind-crd/02-resource.yaml b/test/conformance/kuttl/validate/e2e/lowercase-kind-crd/02-resource.yaml new file mode 100644 index 0000000000..b2edcffef7 --- /dev/null +++ b/test/conformance/kuttl/validate/e2e/lowercase-kind-crd/02-resource.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +apply: +- file: resource.yaml + shouldFail: true diff --git a/test/conformance/kuttl/validate/e2e/lowercase-kind-crd/02-script.yaml b/test/conformance/kuttl/validate/e2e/lowercase-kind-crd/02-script.yaml deleted file mode 100644 index 2514a70dbc..0000000000 --- a/test/conformance/kuttl/validate/e2e/lowercase-kind-crd/02-script.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - if kubectl apply -f resource.yaml 2>&1 | grep -q 'validation error: The label app=foo is required' - then - echo "Test succeeded. Resource creation was blocked." - exit 0 - else - echo "Tested failed. Resource was created." - exit 1 - fi diff --git a/test/conformance/kuttl/validate/e2e/lowercase-kind-crd/99-cleanup.yaml b/test/conformance/kuttl/validate/e2e/lowercase-kind-crd/99-cleanup.yaml deleted file mode 100644 index 9c3fe1fd34..0000000000 --- a/test/conformance/kuttl/validate/e2e/lowercase-kind-crd/99-cleanup.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl delete postgresql acid-minimal-cluster -n test-validate --force --wait=true --ignore-not-found=true - - command: kubectl delete cpol test --force --wait=true --ignore-not-found=true - - command: kubectl delete ns test-validate --force --ignore-not-found=true - - command: kubectl delete crd postgresqls.acid.zalan.do --force --wait=true