mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
9de558575a
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>
22 lines
592 B
Plaintext
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"}
|