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:
parent
5ec66918f6
commit
70b0f99f5e
8 changed files with 25 additions and 67 deletions
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue