Skip to content

Commit 4d95f8c

Browse files
committed
Check duplicate entries in job tiers
1 parent f3165b7 commit 4d95f8c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tools/codegen/pkg/sippy/json_types.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"fmt"
66
"net/url"
77
"strings"
8+
9+
"k8s.io/apimachinery/pkg/util/sets"
810
)
911

1012
type SippyQueryStruct struct {
@@ -103,15 +105,18 @@ func QueriesFor(cloud, architecture, topology, networkStack, os, jobTiers, testP
103105
if jobTiers == "" {
104106
jobTiersList = []string{"standard", "informing", "blocking"}
105107
} else {
106-
// Split by comma and trim whitespace
108+
// Split by comma, trim whitespace, and deduplicate using sets
109+
tierSet := sets.New[string]()
107110
for _, tier := range strings.Split(jobTiers, ",") {
108111
if trimmed := strings.TrimSpace(tier); trimmed != "" {
109-
jobTiersList = append(jobTiersList, trimmed)
112+
tierSet.Insert(trimmed)
110113
}
111114
}
112115
// If all tiers were whitespace/empty after trimming, use defaults
113-
if len(jobTiersList) == 0 {
116+
if tierSet.Len() == 0 {
114117
jobTiersList = []string{"standard", "informing", "blocking"}
118+
} else {
119+
jobTiersList = sets.List(tierSet)
115120
}
116121
}
117122

0 commit comments

Comments
 (0)