mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-29 10:55:05 +00:00
Fix issue where CLI test command ignores failures (#5189)
Closes #5187 The test command was resetting the return value to "pass", even if it was already marked failed, in some cases. This solves by moving the "pass" into an else-if clause. Signed-off-by: Eric Miller <eric.miller@instructure.com> Signed-off-by: Eric Miller <eric.miller@instructure.com> Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com> Co-authored-by: shuting <shuting@nirmata.com>
This commit is contained in:
parent
6091af6fba
commit
001db94d87
1 changed files with 3 additions and 5 deletions
|
@ -67,7 +67,7 @@ applying 1 policy to 2 resources...
|
|||
kyverno test .
|
||||
|
||||
Executing limit-containers-per-pod...
|
||||
applying 1 policy to 4 resources...
|
||||
applying 1 policy to 4 resources...
|
||||
|
||||
│───│──────────────────────────│──────────────────────────────────────│─────────────────────────────│────────│
|
||||
│ # │ POLICY │ RULE │ RESOURCE │ RESULT │
|
||||
|
@ -84,7 +84,7 @@ Test Summary: 4 tests passed and 0 tests failed
|
|||
kyverno test . --test-case-selector "policy=disallow-latest-tag, rule=require-image-tag, resource=test-require-image-tag-pass"
|
||||
|
||||
Executing test-simple...
|
||||
applying 1 policy to 1 resource...
|
||||
applying 1 policy to 1 resource...
|
||||
|
||||
│───│─────────────────────│───────────────────│─────────────────────────────────────────│────────│
|
||||
│ # │ POLICY │ RULE │ RESOURCE │ RESULT │
|
||||
|
@ -787,9 +787,7 @@ func getAndCompareResource(path string, engineResource unstructured.Unstructured
|
|||
if err != nil {
|
||||
log.Log.V(3).Info(resourceType+" mismatch", "error", err.Error())
|
||||
status = "fail"
|
||||
}
|
||||
|
||||
if matched == "" {
|
||||
} else if matched == "" {
|
||||
status = "pass"
|
||||
}
|
||||
return status
|
||||
|
|
Loading…
Add table
Reference in a new issue