Skip to content

Commit 2a5192e

Browse files
authored
Merge pull request #978 from phisco/fix/customresourcesgate-flake-release-2.1
2 parents 9a0de4f + 23c2241 commit 2a5192e

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

pkg/reconciler/customresourcesgate/reconciler_test.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -533,23 +533,25 @@ func TestReconcile(t *testing.T) {
533533

534534
// Only check gate calls if gate is not nil
535535
if tc.fields.gate != nil {
536-
slices.SortFunc(tc.want.trueCalls, func(a, b schema.GroupVersionKind) int {
536+
sortGVK := func(a, b schema.GroupVersionKind) int {
537+
if c := strings.Compare(a.Group, b.Group); c != 0 {
538+
return c
539+
}
540+
if c := strings.Compare(a.Version, b.Version); c != 0 {
541+
return c
542+
}
537543
return strings.Compare(a.Kind, b.Kind)
538-
})
539-
slices.SortFunc(tc.fields.gate.TrueCalls, func(a, b schema.GroupVersionKind) int {
540-
return strings.Compare(a.Kind, b.Kind)
541-
})
544+
}
545+
546+
slices.SortFunc(tc.want.trueCalls, sortGVK)
547+
slices.SortFunc(tc.fields.gate.TrueCalls, sortGVK)
542548

543549
if diff := cmp.Diff(tc.want.trueCalls, tc.fields.gate.TrueCalls); diff != "" {
544550
t.Errorf("\n%s\ngate.True calls: -want, +got:\n%s", tc.reason, diff)
545551
}
546552

547-
slices.SortFunc(tc.want.falseCalls, func(a, b schema.GroupVersionKind) int {
548-
return strings.Compare(a.Kind, b.Kind)
549-
})
550-
slices.SortFunc(tc.fields.gate.FalseCalls, func(a, b schema.GroupVersionKind) int {
551-
return strings.Compare(a.Kind, b.Kind)
552-
})
553+
slices.SortFunc(tc.want.falseCalls, sortGVK)
554+
slices.SortFunc(tc.fields.gate.FalseCalls, sortGVK)
553555

554556
if diff := cmp.Diff(tc.want.falseCalls, tc.fields.gate.FalseCalls); diff != "" {
555557
t.Errorf("\n%s\ngate.False calls: -want, +got:\n%s", tc.reason, diff)

0 commit comments

Comments
 (0)