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