Patch¶
The patch
operation lets you define resources that should be modified in the Kubernetes cluster during the test step. These can be configurations, deployments, services, or any other Kubernetes resource.
Configuration¶
Reference documentation
Warning
If the resource to be modified does not exist in the cluster, the step will fail.
Usage examples¶
Below is an example of using patch
in a Test
resource.
Using a specific file
Using file path expressions
Using an URL
Using an inline resource
Operation check¶
Below is an example of using an operation check.
With check
# ...
- patch:
file: my-configmap.yaml
expect:
- match:
# this check applies only if the match
# statement below evaluates to `true`
apiVersion: v1
kind: ConfigMap
check:
# an error is expected, this will:
# - succeed if the operation failed
# - fail if the operation succeeded
($error != null): true
# ...
With check
# ...
- patch:
resource:
apiVersion: v1
kind: ConfigMap
metadata:
name: chainsaw-quick-start
data:
foo: bar
expect:
- match:
# this check applies only if the match
# statement below evaluates to `true`
apiVersion: v1
kind: ConfigMap
check:
# an error is expected, this will:
# - succeed if the operation failed
# - fail if the operation succeeded
($error != null): true
# ...