Files
releases/cmd/testdata/script/exec.txtar
T
Stephan Renatus 9de558575a cli: fix 'opa exec' parameters
This also adds a new test step running all testscript txtar archives
on all platforms. Our existing lo-fi binary smoke tests should move to
that eventually.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-08-25 20:02:01 +02:00

22 lines
592 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"'
-- policy/pkg.rego --
package pkg
p if input.foo == "bar"
-- input.json --
{"foo": "bar"}