mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-16 13:22:53 -06:00
184d1b553f
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>
35 lines
880 B
Plaintext
35 lines
880 B
Plaintext
# unoptimized
|
|
exec $OPA build --bundle bundle
|
|
exec $OPA eval --format pretty --bundle bundle.tar.gz --input input.json data.test.result --fail
|
|
stdout '^true$'
|
|
! stderr .
|
|
|
|
# unoptimized, stdin
|
|
stdin input.json
|
|
exec $OPA eval --format pretty --bundle bundle.tar.gz -I data.test.result --fail
|
|
stdout '^true$'
|
|
! stderr .
|
|
|
|
# o=1, stdin
|
|
exec $OPA build --output o1.tar.gz --optimize 1 --bundle bundle --entrypoint test/result
|
|
stdin input.json
|
|
exec $OPA eval --format pretty --bundle o1.tar.gz -I data.test.result --fail
|
|
stdout '^true$'
|
|
! stderr .
|
|
|
|
# o=2, stdin
|
|
exec $OPA build --output o2.tar.gz --optimize 2 --bundle bundle --entrypoint test/result
|
|
stdin input.json
|
|
exec $OPA eval --format pretty --bundle o1.tar.gz -I data.test.result --fail
|
|
stdout '^true$'
|
|
! stderr .
|
|
|
|
-- bundle/data.json --
|
|
{}
|
|
-- bundle/test.rego --
|
|
package test
|
|
|
|
result if input.yay
|
|
-- input.json --
|
|
{"yay": true}
|