Skip to content

Commit 32fa708

Browse files
committed
test(e2e): add Ginkgo skipped-spec summary report
Add a ReportAfterSuite node that prints one consolidated block at the end of the e2e run listing every skipped spec and its reason. Programmatic Skip() reasons come from Failure.Message; label-filtered specs get a distinct "(filtered: ...)" marker. Purely informational; never fails the suite. Signed-off-by: Giulio Calzolari <gcalzolari@nvidia.com>
1 parent e828245 commit 32fa708

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

tests/e2e/go/report_skips_test.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//go:build e2e
2+
3+
// Copyright 2026 NVIDIA CORPORATION
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
package e2e
7+
8+
import (
9+
"fmt"
10+
"strings"
11+
12+
. "github.com/onsi/ginkgo/v2"
13+
"github.com/onsi/ginkgo/v2/types"
14+
)
15+
16+
// ReportAfterSuite prints a single, easy-to-find summary of every skipped spec
17+
// and its reason. Ginkgo scatters per-spec `S` markers through the verbose
18+
// multi-profile log; this consolidates them so it is obvious at a glance what
19+
// was skipped and why. It is purely informational and never fails the suite.
20+
var _ = ReportAfterSuite("skipped specs summary", func(report Report) {
21+
// ReportAfterSuite runs once, but guard anyway so parallel runners never
22+
// emit the block twice.
23+
if GinkgoParallelProcess() != 1 {
24+
return
25+
}
26+
27+
var lines []string
28+
for _, spec := range report.SpecReports {
29+
if spec.State != types.SpecStateSkipped {
30+
continue
31+
}
32+
reason := strings.TrimSpace(spec.Failure.Message)
33+
if reason == "" {
34+
reason = "(filtered: did not match label filter)"
35+
}
36+
lines = append(lines, fmt.Sprintf("- %s\n reason: %s", spec.FullText(), reason))
37+
}
38+
39+
var b strings.Builder
40+
fmt.Fprintf(&b, "\n========== SKIPPED SPECS (%d) ==========\n", len(lines))
41+
if len(lines) == 0 {
42+
b.WriteString("No specs skipped.\n")
43+
} else {
44+
b.WriteString(strings.Join(lines, "\n"))
45+
b.WriteString("\n")
46+
}
47+
b.WriteString("=======================================\n")
48+
49+
fmt.Fprint(GinkgoWriter, b.String())
50+
})

0 commit comments

Comments
 (0)