Skip to content

Commit ff983bb

Browse files
committed
scheduler(queue): fix flake test for InFlightPods
1 parent 5c14a57 commit ff983bb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/scheduler/internal/queue/scheduling_queue_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ func Test_InFlightPods(t *testing.T) {
675675
}
676676
fakeClock := testingclock.NewFakeClock(time.Now())
677677
q := NewTestQueueWithObjects(ctx, newDefaultQueueSort(), obj, WithQueueingHintMapPerProfile(test.queueingHintMap), WithClock(fakeClock))
678+
sortOpt := cmpopts.SortSlices(func(a, b string) bool { return a < b })
678679

679680
// When a Pod is added to the queue, the QueuedPodInfo will have a new timestamp.
680681
// On Windows, time.Now() is not as precise, 2 consecutive calls may return the same timestamp.
@@ -734,7 +735,7 @@ func Test_InFlightPods(t *testing.T) {
734735
for _, pod := range pods {
735736
podNames = append(podNames, pod.Name)
736737
}
737-
if diff := cmp.Diff(test.wantActiveQPodNames, podNames); diff != "" {
738+
if diff := cmp.Diff(test.wantActiveQPodNames, podNames, sortOpt); diff != "" {
738739
t.Fatalf("Unexpected diff of activeQ pod names (-want, +got):\n%s", diff)
739740
}
740741

@@ -752,7 +753,7 @@ func Test_InFlightPods(t *testing.T) {
752753
for _, pInfo := range podInfos {
753754
podNames = append(podNames, pInfo.Pod.Name)
754755
}
755-
if diff := cmp.Diff(test.wantBackoffQPodNames, podNames); diff != "" {
756+
if diff := cmp.Diff(test.wantBackoffQPodNames, podNames, sortOpt); diff != "" {
756757
t.Fatalf("Unexpected diff of backoffQ pod names (-want, +got):\n%s", diff)
757758
}
758759

0 commit comments

Comments
 (0)