Skip to content

Commit 01105a1

Browse files
committed
Results summary
1 parent 9371ccd commit 01105a1

1 file changed

Lines changed: 59 additions & 11 deletions

File tree

integration-tests/backend/backend_suite_test.go

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package e2etests
33
import (
44
"flag"
55
"fmt"
6+
"os"
67
"testing"
78

89
g "github.com/onsi/ginkgo/v2"
@@ -24,6 +25,15 @@ var _ = g.BeforeSuite(func() {
2425
// Set up provider config after parsing flags
2526
e2eframework.AfterReadingAllFlags(exutil.TestContext)
2627

28+
// Control verbose event dumping on test failures via DUMP_EVENTS_ON_FAILURE env variable
29+
// Default: disabled (false)
30+
// Set DUMP_EVENTS_ON_FAILURE=true to enable verbose cluster-wide event dumps for debugging
31+
dumpEvents := false
32+
if os.Getenv("DUMP_EVENTS_ON_FAILURE") == "true" {
33+
dumpEvents = true
34+
}
35+
exutil.TestContext.DumpLogsOnFailure = dumpEvents
36+
2737
// Initialize test
2838
gomega.Expect(exutil.InitTest(false)).NotTo(gomega.HaveOccurred())
2939

@@ -106,9 +116,9 @@ var _ = g.ReportAfterEach(func(report g.SpecReport) {
106116
})
107117

108118
var _ = g.ReportAfterSuite("NetObserv Summary", func(report g.Report) {
109-
passed := 0
110-
failed := 0
111-
skipped := 0
119+
var passedSpecs []g.SpecReport
120+
var failedSpecs []g.SpecReport
121+
var skippedSpecs []g.SpecReport
112122
ranTests := 0
113123

114124
// Get only the test specs (not setup/teardown)
@@ -117,33 +127,71 @@ var _ = g.ReportAfterSuite("NetObserv Summary", func(report g.Report) {
117127
for _, specReport := range specs {
118128
switch specReport.State {
119129
case types.SpecStatePassed:
120-
passed++
130+
passedSpecs = append(passedSpecs, specReport)
121131
ranTests++
122132
case types.SpecStateFailed, types.SpecStatePanicked, types.SpecStateInvalid, types.SpecStateAborted, types.SpecStateInterrupted, types.SpecStatePending, types.SpecStateTimedout:
123-
failed++
133+
failedSpecs = append(failedSpecs, specReport)
124134
ranTests++
125135
case types.SpecStateSkipped:
126136
// Skip filtered-out specs: they have State==Skipped but RunTime==0 and no failure info
127137
// Explicitly skipped specs (via Skip()) have State==Skipped but were actually evaluated
128138
if specReport.Failure.Message != "" || specReport.RunTime > 0 {
129139
// Explicitly skipped - test body was evaluated
130-
skipped++
140+
skippedSpecs = append(skippedSpecs, specReport)
131141
}
132142
}
133143
}
134144

135145
// Total specs evaluated (passed + failed + explicitly skipped)
136-
totalEvaluated := ranTests + skipped
146+
totalEvaluated := ranTests + len(skippedSpecs)
137147

138-
fmt.Printf("------------------------------\n")
148+
fmt.Printf("==========================================================================================================\n")
139149
if report.SuiteSucceeded {
140-
fmt.Printf("\nBackend Suite - %d/%d specs • SUCCESS! [%.3f seconds]\n",
150+
fmt.Printf("Backend Suite - %d/%d specs • SUCCESS! [%.3f seconds]\n",
141151
totalEvaluated, totalEvaluated, report.RunTime.Seconds())
142152
} else {
143-
fmt.Printf("\nBackend Suite - %d/%d specs • FAILURE! [%.3f seconds]\n",
153+
fmt.Printf("Backend Suite - %d/%d specs • FAILURE! [%.3f seconds]\n",
144154
totalEvaluated, totalEvaluated, report.RunTime.Seconds())
145155
}
146156

147157
fmt.Printf("\nRan %d tests\n", ranTests)
148-
fmt.Printf("Passed: %d, Failed: %d, Skipped: %d\n", passed, failed, skipped)
158+
fmt.Printf("Passed: %d, Failed: %d, Skipped: %d\n", len(passedSpecs), len(failedSpecs), len(skippedSpecs))
159+
fmt.Printf("==========================================================================================================\n\n")
160+
161+
// Print failed tests section
162+
if len(failedSpecs) > 0 {
163+
fmt.Printf("FAILED TESTS (%d):\n", len(failedSpecs))
164+
fmt.Printf("----------------------------------------------------------------------------------------------------------\n")
165+
for i, spec := range failedSpecs {
166+
fmt.Printf("%d. %s\n", i+1, spec.FullText())
167+
fmt.Printf(" %s [%.3f seconds]\n", spec.LeafNodeLocation.String(), spec.RunTime.Seconds())
168+
if spec.Failure.Message != "" {
169+
fmt.Printf(" Error: %s\n", spec.Failure.Message)
170+
}
171+
}
172+
fmt.Printf("\n")
173+
}
174+
175+
// Print passed tests section
176+
if len(passedSpecs) > 0 {
177+
fmt.Printf("PASSED TESTS (%d):\n", len(passedSpecs))
178+
fmt.Printf("----------------------------------------------------------------------------------------------------------\n")
179+
for i, spec := range passedSpecs {
180+
fmt.Printf("%d. %s [%.3f seconds]\n", i+1, spec.FullText(), spec.RunTime.Seconds())
181+
}
182+
fmt.Printf("\n")
183+
}
184+
185+
// Print skipped tests section
186+
if len(skippedSpecs) > 0 {
187+
fmt.Printf("SKIPPED TESTS (%d):\n", len(skippedSpecs))
188+
fmt.Printf("----------------------------------------------------------------------------------------------------------\n")
189+
for i, spec := range skippedSpecs {
190+
fmt.Printf("%d. %s [%.3f seconds]\n", i+1, spec.FullText(), spec.RunTime.Seconds())
191+
if spec.Failure.Message != "" {
192+
fmt.Printf(" Reason: %s\n", spec.Failure.Message)
193+
}
194+
}
195+
fmt.Printf("\n")
196+
}
149197
})

0 commit comments

Comments
 (0)