@@ -954,22 +954,27 @@ func TestCoreResourceEnqueue(t *testing.T) {
954
954
}
955
955
}
956
956
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.
958
958
if err := wait .PollUntilContextTimeout (ctx , time .Millisecond * 200 , wait .ForeverTestTimeout , false , func (ctx context.Context ) (bool , error ) {
959
959
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
961
961
}); err != nil {
962
962
t .Fatal (err )
963
963
}
964
964
965
965
t .Log ("Confirmed Pods in the scheduling queue, starting to schedule them" )
966
966
967
- // Pop all pods out. They should be unschedulable.
967
+ // Pop all pods out. They should become unschedulable.
968
968
for i := 0 ; i < len (tt .pods ); i ++ {
969
969
testCtx .Scheduler .ScheduleOne (testCtx .Ctx )
970
970
}
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.
972
972
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
+
973
978
pendingPods , _ := testCtx .Scheduler .SchedulingQueue .PendingPods ()
974
979
return len (pendingPods ) == len (tt .pods ), nil
975
980
}); err != nil {
0 commit comments