venom
venom copied to clipboard
exec: add a 'stdin' attribute
If set, the value is written to the script stdin. This avoid the need to use 'echo' in the script, which makes thing clearer.
It is also particularly useful in the following case (probably other issues with variable substitution):
name: simple_test
vars:
payload: {"s": "\n"}
testcases:
- name: simple_test
steps:
- type: exec
script: echo {{.payload | toJSON}} | jq .
assertions:
- result.code MustEqual 0
This will fail because the \n is not properly escaped.
Using the new stdin attribute solves the issue:
name: simple_test
vars:
payload: {"s": "\n"}
testcases:
- name: simple_test
steps:
- type: exec
stdin: {{.payload | toJSON}}
script: jq .
assertions:
- result.code MustEqual 0