OPA新手,我正在编写OPA单元测试用例。
test_valid_type {
response = evaluate with
input as valid_type
response == "approved"
}
它失败了response == "approved"
.我想查看响应变量的输出,如何输出?
尝试 OPA 提供的trace
方法进行调试。 https://www.openpolicyagent.org/docs/latest/policy-reference/#debugging
这将允许您打印输出。 在您的示例中,您可以添加将打印响应输出的trace(response)
。
看了很多文献后终于找到了。
trace(variable)
打印变量的内容。
[Ref][1]