Skip to content

Commit befeb00

Browse files
authored
Merge pull request kubernetes#127641 from dom4ha/integration-test-fix
Increase the readability of the test preconditions and double check that all test pods are really unschedulable.
2 parents 3d6c5b2 + 9bf6ee9 commit befeb00

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/integration/scheduler/queue_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -954,22 +954,27 @@ func TestCoreResourceEnqueue(t *testing.T) {
954954
}
955955
}
956956

957-
// Wait for the tt.pods to be present in the scheduling queue.
957+
// Wait for the tt.pods to be present in the scheduling active queue.
958958
if err := wait.PollUntilContextTimeout(ctx, time.Millisecond*200, wait.ForeverTestTimeout, false, func(ctx context.Context) (bool, error) {
959959
pendingPods, _ := testCtx.Scheduler.SchedulingQueue.PendingPods()
960-
return len(pendingPods) == len(tt.pods), nil
960+
return len(pendingPods) == len(tt.pods) && len(testCtx.Scheduler.SchedulingQueue.PodsInActiveQ()) == len(tt.pods), nil
961961
}); err != nil {
962962
t.Fatal(err)
963963
}
964964

965965
t.Log("Confirmed Pods in the scheduling queue, starting to schedule them")
966966

967-
// Pop all pods out. They should be unschedulable.
967+
// Pop all pods out. They should become unschedulable.
968968
for i := 0; i < len(tt.pods); i++ {
969969
testCtx.Scheduler.ScheduleOne(testCtx.Ctx)
970970
}
971-
// Wait for the tt.pods to be still present in the scheduling queue.
971+
// Wait for the tt.pods to be still present in the scheduling (unschedulable) queue.
972972
if err := wait.PollUntilContextTimeout(ctx, time.Millisecond*200, wait.ForeverTestTimeout, false, func(ctx context.Context) (bool, error) {
973+
activePodsCount := len(testCtx.Scheduler.SchedulingQueue.PodsInActiveQ())
974+
if activePodsCount > 0 {
975+
return false, fmt.Errorf("Active queue was expected to be empty, but found %v Pods", activePodsCount)
976+
}
977+
973978
pendingPods, _ := testCtx.Scheduler.SchedulingQueue.PendingPods()
974979
return len(pendingPods) == len(tt.pods), nil
975980
}); err != nil {

0 commit comments

Comments
 (0)