mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #79631 from Huang-Wei/sched-q-flake
Fixed a racing issue in scheduler UT
This commit is contained in:
commit
5257266e9b
@ -293,12 +293,12 @@ func TestPriorityQueue_AddUnschedulableIfNotPresent(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestPriorityQueue_AddUnschedulableIfNotPresent_Backoff tests scenario when
|
// TestPriorityQueue_AddUnschedulableIfNotPresent_Backoff tests the scenarios when
|
||||||
// AddUnschedulableIfNotPresent is called asynchronously pods in and before
|
// AddUnschedulableIfNotPresent is called asynchronously.
|
||||||
// current scheduling cycle will be put back to activeQueue if we were trying
|
// Pods in and before current scheduling cycle will be put back to activeQueue
|
||||||
// to schedule them when we received move request.
|
// if we were trying to schedule them when we received move request.
|
||||||
func TestPriorityQueue_AddUnschedulableIfNotPresent_Backoff(t *testing.T) {
|
func TestPriorityQueue_AddUnschedulableIfNotPresent_Backoff(t *testing.T) {
|
||||||
q := NewPriorityQueue(nil, nil)
|
q := NewPriorityQueueWithClock(nil, clock.NewFakeClock(time.Now()), nil)
|
||||||
totalNum := 10
|
totalNum := 10
|
||||||
expectedPods := make([]v1.Pod, 0, totalNum)
|
expectedPods := make([]v1.Pod, 0, totalNum)
|
||||||
for i := 0; i < totalNum; i++ {
|
for i := 0; i < totalNum; i++ {
|
||||||
@ -348,7 +348,9 @@ func TestPriorityQueue_AddUnschedulableIfNotPresent_Backoff(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
q.AddUnschedulableIfNotPresent(unschedulablePod, oldCycle)
|
if err := q.AddUnschedulableIfNotPresent(unschedulablePod, oldCycle); err != nil {
|
||||||
|
t.Errorf("Failed to call AddUnschedulableIfNotPresent(%v): %v", unschedulablePod.Name, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since there was a move request at the same cycle as "oldCycle", these pods
|
// Since there was a move request at the same cycle as "oldCycle", these pods
|
||||||
|
Loading…
Reference in New Issue
Block a user