Files
Stephan Renatus 184d1b553f ci: port binary tests to testscript
The assertions are stricter now, e.g. we're also checking that nothing
is emitted to stderr.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-08-29 17:57:50 +02:00

29 lines
762 B
Plaintext

# input from file
exec $OPA exec --bundle policy/ --decision /pkg/p ./input.json
stdout '"result": true'
! stderr .
# input from stdin
stdin input.json
exec $OPA exec --bundle policy/ --decision /pkg/p --stdin-input
stdout '"result": true'
! stderr .
# fail on non-empty inputs
! exec $OPA exec --bundle policy/ --fail-non-empty --decision /pkg/p ./input.json
stdout '"result": true'
stderr '"exec error: there were 1 failures and 0 errors counted in the results list, and --fail-non-empty is set"'
# with bundle
exec $OPA build --bundle policy/
stdin input.json
exec $OPA exec --bundle bundle.tar.gz --decision /pkg/p --stdin-input
stdout '"result": true'
! stderr .
-- policy/pkg.rego --
package pkg
p if input.foo == "bar"
-- input.json --
{"foo": "bar"}