Pass data to tests¶
Chainsaw can pass arbitrary values when running tests using the --values
flag. Values will be available to tests under the $values
binding.
This is useful when a test needs to be configured externally.
Reference external data¶
The test below expects the $value.foo
to be provided when chainsaw is invoked.
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: example
spec:
steps:
- try:
- assert:
resource:
($values.foo): bar
Invoking Chainsaw¶
Read values from a file¶
chainsaw test --values ./values.yaml
Read from stdin¶
echo "foo: bar" | chainsaw test --values -
Use heredoc¶
chainsaw test --values - <<EOF
foo: bar
EOF