Skip to content

Commit 971af55

Browse files
committed
fix test flackyness caused by unordered ports
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 536bece commit 971af55

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

loader/merge.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,18 @@ func toServicePortConfigsSlice(dst reflect.Value, m map[interface{}]interface{})
203203
for _, v := range m {
204204
s = append(s, v.(types.ServicePortConfig))
205205
}
206-
sort.Slice(s, func(i, j int) bool { return s[i].Published < s[j].Published })
206+
sort.Slice(s, func(i, j int) bool {
207+
if s[i].Target != s[j].Target {
208+
return s[i].Target < s[j].Target
209+
}
210+
if s[i].Published != s[j].Published {
211+
return s[i].Published < s[j].Published
212+
}
213+
if s[i].HostIP != s[j].HostIP {
214+
return s[i].HostIP < s[j].HostIP
215+
}
216+
return s[i].Protocol < s[j].Protocol
217+
})
207218
dst.Set(reflect.ValueOf(s))
208219
return nil
209220
}

0 commit comments

Comments
 (0)