2

Newbie to OPA, I am writing OPA unit test case.

test_valid_type {
  response = evaluate with
             input as valid_type
  response == "approved"
}

it's failing response == "approved". I want to see the output of response variable, how do i output it?

Will Beason
  • 3,417
  • 2
  • 28
  • 46
prashant
  • 2,808
  • 5
  • 26
  • 41

2 Answers2

3

Try the trace method provided by OPA for debugging. https://www.openpolicyagent.org/docs/latest/policy-reference/#debugging

This will let you print the output. In your example you can add trace(response) which will print the response output.

Anmol Agrawal
  • 814
  • 4
  • 6
0

After reading many documention finally found it.

trace(variable) 

prints the content of the variable.

[Ref][1]
prashant
  • 2,808
  • 5
  • 26
  • 41