1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00

fixed policy report test cases

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
This commit is contained in:
NoSkillGirl 2021-09-02 02:43:07 +05:30
parent 6b5cf01574
commit 9f472a768f

View file

@ -140,23 +140,19 @@ func Test_buildPolicyResults(t *testing.T) {
info := kyvCommon.CheckValidateEngineResponse(&policy, &er, "", rc, true)
pvInfos = append(pvInfos, info)
results := buildPolicyReports(pvInfos)
results := buildPolicyResults(pvInfos)
// results := buildPolicyResults(engineResponses, nil)
// assert.Assert(t, len(results[clusterpolicyreport]) == 2, len(results[clusterpolicyreport]))
// assert.Assert(t, len(results["policyreport-ns-policy1-namespace"]) == 2, len(results["policyreport-ns-policy1-namespace"]))
// for _, result := range results {
// assert.Assert(t, len(result) == 2, len(result))
// for _, r := range result {
// switch r.Rule {
// case "policy1-rule1", "clusterpolicy2-rule1":
// assert.Assert(t, r.Result == report.PolicyResult(preport.StatusPass))
// case "policy1-rule2", "clusterpolicy2-rule2":
// assert.Assert(t, r.Result == report.PolicyResult(preport.StatusFail))
// }
// }
// }
for _, result := range results {
assert.Assert(t, len(result) == 2, len(result))
for _, r := range result {
switch r.Rule {
case "pods-require-limits":
assert.Assert(t, r.Result == report.PolicyResult(preport.StatusPass))
case "pods-require-account":
assert.Assert(t, r.Result == report.PolicyResult(preport.StatusFail))
}
}
}
}
func Test_calculateSummary(t *testing.T) {