Finally¶
A finally
statement is similar to a catch statement but will always execute after the try and eventual catch statements finished executing regardless of the success or failure of the test step.
Tip
All operations and collectors of a finally
statement will be executed regardless of the success or failure of each of them.
Operations¶
A finally
statement supports only the following operations:
Collectors¶
A finally
statement supports all collectors:
Example¶
Example
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: TestStep
metadata:
name: example
spec:
try:
#...
catch:
#...
finally:
# collect events in the test namespace
- events: {}
# collect pods logs in the test namespace
- podLogs: {}
# take a small break
- sleep:
duration: 15s
# execute a custom script
- script:
content: echo "That's all folks"
# ...