mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
Increase the readability of the test preconditions and double check that all test pods are really unschedulable.
This commit is contained in:
parent
3d6c5b2e98
commit
151ac846a2
@ -954,27 +954,30 @@ func TestCoreResourceEnqueue(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for the tt.pods to be present in the scheduling queue.
|
// Wait for the tt.pods to be present in the scheduling active 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) {
|
||||||
pendingPods, _ := testCtx.Scheduler.SchedulingQueue.PendingPods()
|
return len(testCtx.Scheduler.SchedulingQueue.PodsInActiveQ()) == len(tt.pods), nil
|
||||||
return len(pendingPods) == len(tt.pods), nil
|
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Log("Confirmed Pods in the scheduling queue, starting to schedule them")
|
t.Log("Confirmed Pods in the scheduling queue, starting to schedule them")
|
||||||
|
|
||||||
// Pop all pods out. They should be unschedulable.
|
// Pop all pods out. They should become unschedulable.
|
||||||
for i := 0; i < len(tt.pods); i++ {
|
for i := 0; i < len(tt.pods); i++ {
|
||||||
testCtx.Scheduler.ScheduleOne(testCtx.Ctx)
|
testCtx.Scheduler.ScheduleOne(testCtx.Ctx)
|
||||||
}
|
}
|
||||||
// Wait for the tt.pods to be still present in the scheduling 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) {
|
||||||
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