From cc391e25ba285c19986aa0bdd1b7186ae9f10bb3 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 28 Apr 2026 11:15:20 +0200 Subject: [PATCH] E2E framework: avoid duplicate FeatureGate tags 75448c416b9e31 added feature gate dependencies at the end of a test name. However, if those tags were already part of the previous text, either because they were explicitly added in the current node or in some parent node, then redundant tags were added. Now this special case is detected and such redundant tags do not get added again. --- test/e2e/framework/ginkgowrapper.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/e2e/framework/ginkgowrapper.go b/test/e2e/framework/ginkgowrapper.go index ff52bd35b7b..7f2735dd206 100644 --- a/test/e2e/framework/ginkgowrapper.go +++ b/test/e2e/framework/ginkgowrapper.go @@ -293,13 +293,16 @@ func expandGinkgoArgs(leafNode bool, offset ginkgo.Offset, text string, args []a if text != "" { texts = append(texts, text) } + previousText := "" // All labels for a leaf node, from parent and added in this call. allLabels := sets.New[string]() if leafNode { // May only be called during tree construction, i.e. not for the top-level node, // so we have to be a bit careful. - allLabels = sets.New[string](ginkgo.CurrentTreeConstructionNodeReport().Labels()...) + report := ginkgo.CurrentTreeConstructionNodeReport() + previousText = report.FullText() + allLabels = sets.New[string](report.Labels()...) } addLabel := func(label string) { ginkgoArgs = append(ginkgoArgs, ginkgo.Label(label)) @@ -404,7 +407,15 @@ func expandGinkgoArgs(leafNode bool, offset ginkgo.Offset, text string, args []a slices.Sort(delayedLabels) for _, label := range delayedLabels { - texts = append(texts, fmt.Sprintf("[%s]", label)) + text := fmt.Sprintf("[%s]", label) + if strings.Contains(previousText, text) || + slices.Contains(texts, text) { + // Never repeat text at the end which was already included earlier. + // In practice, this can happen for a FeatureGate when it was both + // explicitly mentioned and a dependency. + continue + } + texts = append(texts, text) // This keeps validateText happy. ginkgoArgs = append(ginkgoArgs, ginkgo.Label(label)) }