From ae8804ff2100a150cd82816632fabc062e9fec32 Mon Sep 17 00:00:00 2001 From: Daniel Fajmon Date: Tue, 29 Apr 2025 13:57:33 +0200 Subject: [PATCH] UPSTREAM: : fix conditional labels when in different folder structure than expected --- openshift-hack/e2e/annotate/annotate.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/openshift-hack/e2e/annotate/annotate.go b/openshift-hack/e2e/annotate/annotate.go index 096ae2a00aa96..1b0b3b617ae13 100644 --- a/openshift-hack/e2e/annotate/annotate.go +++ b/openshift-hack/e2e/annotate/annotate.go @@ -231,10 +231,7 @@ func (r *ginkgoTestRenamer) generateRename(name string, node types.TestSpec) { newLabels += " [Suite:openshift/conformance/parallel]" } } - codeLocations := node.CodeLocations() - if isGoModulePath(codeLocations[len(codeLocations)-1].FileName, "k8s.io/kubernetes", "test/e2e") { - newLabels += " [Suite:k8s]" - } + newLabels += " [Suite:k8s]" if err := checkBalancedBrackets(newName); err != nil { r.errors = append(r.errors, err.Error()) @@ -242,17 +239,6 @@ func (r *ginkgoTestRenamer) generateRename(name string, node types.TestSpec) { r.output[name] = newLabels } -// isGoModulePath returns true if the packagePath reported by reflection is within a -// module and given module path. When go mod is in use, module and modulePath are not -// contiguous as they were in older golang versions with vendoring, so naive contains -// tests fail. -// -// historically: ".../vendor/k8s.io/kubernetes/test/e2e" -// go.mod: "k8s.io/kubernetes@0.18.4/test/e2e" -func isGoModulePath(packagePath, module, modulePath string) bool { - return regexp.MustCompile(fmt.Sprintf(`\b%s(@[^/]*|)/%s\b`, regexp.QuoteMeta(module), regexp.QuoteMeta(modulePath))).MatchString(packagePath) -} - // checkBalancedBrackets ensures that square brackets are balanced in generated test // names. If they are not, it returns an error with the name of the test and a guess // where the unmatched bracket(s) are.