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

fix test output numbering ()

Signed-off-by: Anant Vijay <anantvijay3@gmail.com>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
This commit is contained in:
XDRAGON2002 2022-10-11 18:00:11 +05:30 committed by GitHub
parent 2860775dc3
commit df12c80b95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1037,9 +1037,13 @@ func printTestResult(resps map[string]policyreportv1alpha2.PolicyReportResult, t
boldFgCyan := color.New(color.FgCyan).Add(color.Bold) boldFgCyan := color.New(color.FgCyan).Add(color.Bold)
var countDeprecatedResource int var countDeprecatedResource int
for i, v := range testResults { testCount := 1
for _, v := range testResults {
res := new(Table) res := new(Table)
res.ID = i + 1 res.ID = testCount
if v.Resources == nil {
testCount++
}
if !removeColor { if !removeColor {
res.Policy = boldFgCyan.Sprintf(v.Policy) res.Policy = boldFgCyan.Sprintf(v.Policy)
res.Rule = boldFgCyan.Sprintf(v.Rule) res.Rule = boldFgCyan.Sprintf(v.Rule)
@ -1050,6 +1054,8 @@ func printTestResult(resps map[string]policyreportv1alpha2.PolicyReportResult, t
if v.Resources != nil { if v.Resources != nil {
for _, resource := range v.Resources { for _, resource := range v.Resources {
res.ID = testCount
testCount++
if !removeColor { if !removeColor {
res.Resource = boldFgCyan.Sprintf(v.Namespace) + "/" + boldFgCyan.Sprintf(v.Kind) + "/" + boldFgCyan.Sprintf(resource) res.Resource = boldFgCyan.Sprintf(v.Namespace) + "/" + boldFgCyan.Sprintf(v.Kind) + "/" + boldFgCyan.Sprintf(resource)
} else { } else {