@@ -443,18 +443,26 @@ func TestPriorityQueue_NominatedPodsForNode(t *testing.T) {
443
443
}
444
444
445
445
func TestPriorityQueue_PendingPods (t * testing.T ) {
446
+ makeSet := func (pods []* v1.Pod ) map [* v1.Pod ]struct {} {
447
+ pendingSet := map [* v1.Pod ]struct {}{}
448
+ for _ , p := range pods {
449
+ pendingSet [p ] = struct {}{}
450
+ }
451
+ return pendingSet
452
+ }
453
+
446
454
q := NewPriorityQueue (nil )
447
455
q .Add (& medPriorityPod )
448
456
addOrUpdateUnschedulablePod (q , & unschedulablePod )
449
457
addOrUpdateUnschedulablePod (q , & highPriorityPod )
450
- expectedList := []* v1.Pod {& medPriorityPod , & unschedulablePod , & highPriorityPod }
451
- if ! reflect .DeepEqual (expectedList , q .PendingPods ()) {
452
- t .Error ("Unexpected list of pending Pods for node ." )
458
+ expectedSet := makeSet ( []* v1.Pod {& medPriorityPod , & unschedulablePod , & highPriorityPod })
459
+ if ! reflect .DeepEqual (expectedSet , makeSet ( q .PendingPods () )) {
460
+ t .Error ("Unexpected list of pending Pods." )
453
461
}
454
462
// Move all to active queue. We should still see the same set of pods.
455
463
q .MoveAllToActiveQueue ()
456
- if ! reflect .DeepEqual (expectedList , q .PendingPods ()) {
457
- t .Error ("Unexpected list of pending Pods for node ." )
464
+ if ! reflect .DeepEqual (expectedSet , makeSet ( q .PendingPods () )) {
465
+ t .Error ("Unexpected list of pending Pods.. ." )
458
466
}
459
467
}
460
468
@@ -954,8 +962,8 @@ func TestHighProirotyFlushUnschedulableQLeftover(t *testing.T) {
954
962
},
955
963
}
956
964
957
- q . unschedulableQ . addOrUpdate ( & highPod )
958
- q . unschedulableQ . addOrUpdate ( & midPod )
965
+ addOrUpdateUnschedulablePod ( q , & highPod )
966
+ addOrUpdateUnschedulablePod ( q , & midPod )
959
967
960
968
// Update pod condition to highPod.
961
969
podutil .UpdatePodCondition (& highPod .Status , & v1.PodCondition {
0 commit comments