1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-15 00:36:28 +00:00

chore: improve a few kuttl tests using shouldFail instead of commands (#6791)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-04-05 17:47:01 +02:00 committed by GitHub
parent 5ec66918f6
commit 70b0f99f5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 67 deletions

View file

@ -3,13 +3,6 @@
## indicate that creation of a file should fail. See the BEST_PRACTICES.md file for an example.
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
if kubectl apply -f manifests.yaml
then
echo "Tested failed. Policy was created when it shouldn't have been."
exit 1
else
echo "Test succeeded. Policy was not created as intended."
exit 0
fi
apply:
- file: manifests.yaml
shouldFail: true

View file

@ -0,0 +1,6 @@
## 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
apply:
- file: manifests.yaml
shouldFail: true

View file

@ -1,13 +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 manifests.yaml
then
echo "Tested failed. Policy was created when it shouldn't have been."
exit 1
else
echo "Test succeeded. Policy was not created as intended."
exit 0
fi

View file

@ -0,0 +1,7 @@
# 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
apply:
- file: policy.yaml
shouldFail: true

View file

@ -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 policy.yaml
then
echo "Tested failed. policy was allowed."
exit 1
else
echo "Test succeeded. policy was blocked."
exit 0
fi

View file

@ -1,13 +1,6 @@
## 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 bad.yaml
then
echo "Tested failed. Pod was created when it shouldn't have been."
exit 1
else
echo "Test succeeded. Pod was not created as intended."
exit 0
fi
apply:
- file: bad.yaml
shouldFail: true

View file

@ -1,13 +1,6 @@
## 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 bad.yaml
then
echo "Tested failed. Pod was created when it shouldn't have been."
exit 1
else
echo "Test succeeded. Pod was not created as intended."
exit 0
fi
apply:
- file: bad.yaml
shouldFail: true

View file

@ -1,13 +1,6 @@
## 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 bad.yaml
then
echo "Tested failed. ConfigMap was created when it shouldn't have been."
exit 1
else
echo "Test succeeded. ConfigMap was not created as intended."
exit 0
fi
apply:
- file: bad.yaml
shouldFail: true