Skip to content

Commit ae8804f

Browse files
committed
UPSTREAM: <carry>: fix conditional labels when in different folder structure than expected
1 parent 76a7b99 commit ae8804f

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

openshift-hack/e2e/annotate/annotate.go

+1-15
Original file line numberDiff line numberDiff line change
@@ -231,28 +231,14 @@ func (r *ginkgoTestRenamer) generateRename(name string, node types.TestSpec) {
231231
newLabels += " [Suite:openshift/conformance/parallel]"
232232
}
233233
}
234-
codeLocations := node.CodeLocations()
235-
if isGoModulePath(codeLocations[len(codeLocations)-1].FileName, "k8s.io/kubernetes", "test/e2e") {
236-
newLabels += " [Suite:k8s]"
237-
}
234+
newLabels += " [Suite:k8s]"
238235

239236
if err := checkBalancedBrackets(newName); err != nil {
240237
r.errors = append(r.errors, err.Error())
241238
}
242239
r.output[name] = newLabels
243240
}
244241

245-
// isGoModulePath returns true if the packagePath reported by reflection is within a
246-
// module and given module path. When go mod is in use, module and modulePath are not
247-
// contiguous as they were in older golang versions with vendoring, so naive contains
248-
// tests fail.
249-
//
250-
// historically: ".../vendor/k8s.io/kubernetes/test/e2e"
251-
// go.mod: "k8s.io/[email protected]/test/e2e"
252-
func isGoModulePath(packagePath, module, modulePath string) bool {
253-
return regexp.MustCompile(fmt.Sprintf(`\b%s(@[^/]*|)/%s\b`, regexp.QuoteMeta(module), regexp.QuoteMeta(modulePath))).MatchString(packagePath)
254-
}
255-
256242
// checkBalancedBrackets ensures that square brackets are balanced in generated test
257243
// names. If they are not, it returns an error with the name of the test and a guess
258244
// where the unmatched bracket(s) are.

0 commit comments

Comments
 (0)