Skip to content

Commit 7c04dea

Browse files
committed
only append label to spec name when not present
1 parent 89bd739 commit 7c04dea

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/test/extensions/labels.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package extensions
22

33
import (
44
"fmt"
5+
"strings"
56

67
et "github.com/openshift-eng/openshift-tests-extension/pkg/extension/extensiontests"
78
)
@@ -25,10 +26,12 @@ func addLabelsToSpecs(specs et.ExtensionTestSpecs) {
2526
selectFunctions = append(selectFunctions, et.NameContains(name))
2627
}
2728

28-
// Add the label AND append it to the name
29+
// Add the label AND append it to the name (if it isn't present already)
2930
matching := specs.SelectAny(selectFunctions)
3031
for _, spec := range matching {
31-
spec.Name = fmt.Sprintf("%s %s", spec.Name, label)
32+
if !strings.Contains(spec.Name, label) {
33+
spec.Name = fmt.Sprintf("%s %s", spec.Name, label)
34+
}
3235
spec.Labels.Insert(label)
3336
}
3437
}

0 commit comments

Comments
 (0)