mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
Assert whethere there are no pod in active queue while waiting for all pods to get scheduled instead of asserting it afterwards.
This commit is contained in:
parent
54b0ed45b7
commit
9bf6ee976b
@ -970,15 +970,16 @@ func TestCoreResourceEnqueue(t *testing.T) {
|
|||||||
}
|
}
|
||||||
// Wait for the tt.pods to be still present in the scheduling (unschedulable) queue.
|
// Wait for the tt.pods to be still present in the scheduling (unschedulable) queue.
|
||||||
if err := wait.PollUntilContextTimeout(ctx, time.Millisecond*200, wait.ForeverTestTimeout, false, func(ctx context.Context) (bool, error) {
|
if err := wait.PollUntilContextTimeout(ctx, time.Millisecond*200, wait.ForeverTestTimeout, false, func(ctx context.Context) (bool, error) {
|
||||||
|
activePodsCount := len(testCtx.Scheduler.SchedulingQueue.PodsInActiveQ())
|
||||||
|
if activePodsCount > 0 {
|
||||||
|
return false, fmt.Errorf("Active queue was expected to be empty, but found %v Pods", activePodsCount)
|
||||||
|
}
|
||||||
|
|
||||||
pendingPods, _ := testCtx.Scheduler.SchedulingQueue.PendingPods()
|
pendingPods, _ := testCtx.Scheduler.SchedulingQueue.PendingPods()
|
||||||
return len(pendingPods) == len(tt.pods), nil
|
return len(pendingPods) == len(tt.pods), nil
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
activePodsCount := len(testCtx.Scheduler.SchedulingQueue.PodsInActiveQ())
|
|
||||||
if activePodsCount > 0 {
|
|
||||||
t.Fatalf("Active queue was expected to be empty, but found %v Pods", activePodsCount)
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Log("finished initial schedulings for all Pods, will trigger triggerFn")
|
t.Log("finished initial schedulings for all Pods, will trigger triggerFn")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user