@@ -793,13 +793,14 @@ func TestSchedulerScheduleOne(t *testing.T) {
793
793
t .Fatal (err )
794
794
}
795
795
796
+ informerFactory := informers .NewSharedInformerFactory (client , 0 )
796
797
sched := & Scheduler {
797
798
Cache : cache ,
798
799
client : client ,
799
800
NextPod : func (logger klog.Logger ) (* framework.QueuedPodInfo , error ) {
800
801
return & framework.QueuedPodInfo {PodInfo : mustNewPodInfo (t , item .sendPod )}, nil
801
802
},
802
- SchedulingQueue : internalqueue .NewTestQueue ( ctx , nil ),
803
+ SchedulingQueue : internalqueue .NewSchedulingQueue ( nil , informerFactory ),
803
804
Profiles : profile.Map {testSchedulerName : fwk },
804
805
}
805
806
@@ -2472,7 +2473,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
2472
2473
test .registerPlugins , "" ,
2473
2474
frameworkruntime .WithSnapshotSharedLister (snapshot ),
2474
2475
frameworkruntime .WithInformerFactory (informerFactory ),
2475
- frameworkruntime .WithPodNominator (internalqueue .NewTestPodNominator ( informerFactory . Core (). V1 (). Pods (). Lister () )),
2476
+ frameworkruntime .WithPodNominator (internalqueue .NewSchedulingQueue ( nil , informerFactory )),
2476
2477
)
2477
2478
if err != nil {
2478
2479
t .Fatal (err )
@@ -2538,7 +2539,7 @@ func TestFindFitAllError(t *testing.T) {
2538
2539
tf .RegisterBindPlugin (defaultbinder .Name , defaultbinder .New ),
2539
2540
},
2540
2541
"" ,
2541
- frameworkruntime .WithPodNominator (internalqueue .NewTestPodNominator ( nil )),
2542
+ frameworkruntime .WithPodNominator (internalqueue .NewTestQueue ( ctx , nil )),
2542
2543
)
2543
2544
if err != nil {
2544
2545
t .Fatal (err )
@@ -2581,7 +2582,7 @@ func TestFindFitSomeError(t *testing.T) {
2581
2582
tf .RegisterBindPlugin (defaultbinder .Name , defaultbinder .New ),
2582
2583
},
2583
2584
"" ,
2584
- frameworkruntime .WithPodNominator (internalqueue .NewTestPodNominator ( nil )),
2585
+ frameworkruntime .WithPodNominator (internalqueue .NewTestQueue ( ctx , nil )),
2585
2586
)
2586
2587
if err != nil {
2587
2588
t .Fatal (err )
@@ -2652,10 +2653,18 @@ func TestFindFitPredicateCallCounts(t *testing.T) {
2652
2653
logger , ctx := ktesting .NewTestContext (t )
2653
2654
ctx , cancel := context .WithCancel (ctx )
2654
2655
defer cancel ()
2656
+
2657
+ informerFactory := informers .NewSharedInformerFactory (clientsetfake .NewClientset (), 0 )
2658
+ podInformer := informerFactory .Core ().V1 ().Pods ().Informer ()
2659
+ err := podInformer .GetStore ().Add (test .pod )
2660
+ if err != nil {
2661
+ t .Fatalf ("Error adding pod to podInformer: %s" , err )
2662
+ }
2663
+
2655
2664
fwk , err := tf .NewFramework (
2656
2665
ctx ,
2657
2666
registerPlugins , "" ,
2658
- frameworkruntime .WithPodNominator (internalqueue .NewTestPodNominator (nil )),
2667
+ frameworkruntime .WithPodNominator (internalqueue .NewSchedulingQueue (nil , informerFactory )),
2659
2668
)
2660
2669
if err != nil {
2661
2670
t .Fatal (err )
@@ -2669,6 +2678,10 @@ func TestFindFitPredicateCallCounts(t *testing.T) {
2669
2678
if err != nil {
2670
2679
t .Fatal (err )
2671
2680
}
2681
+ err = podInformer .GetStore ().Add (podinfo .Pod )
2682
+ if err != nil {
2683
+ t .Fatalf ("Error adding nominated pod to podInformer: %s" , err )
2684
+ }
2672
2685
fwk .AddNominatedPod (logger , podinfo , & framework.NominatingInfo {NominatingMode : framework .ModeOverride , NominatedNodeName : "1" })
2673
2686
2674
2687
_ , _ , err = scheduler .findNodesThatFitPod (ctx , fwk , framework .NewCycleState (), test .pod )
@@ -2796,7 +2809,7 @@ func TestZeroRequest(t *testing.T) {
2796
2809
frameworkruntime .WithInformerFactory (informerFactory ),
2797
2810
frameworkruntime .WithSnapshotSharedLister (snapshot ),
2798
2811
frameworkruntime .WithClientSet (client ),
2799
- frameworkruntime .WithPodNominator (internalqueue .NewTestPodNominator ( informerFactory . Core (). V1 (). Pods (). Lister () )),
2812
+ frameworkruntime .WithPodNominator (internalqueue .NewSchedulingQueue ( nil , informerFactory )),
2800
2813
)
2801
2814
if err != nil {
2802
2815
t .Fatalf ("error creating framework: %+v" , err )
@@ -3199,7 +3212,7 @@ func Test_prioritizeNodes(t *testing.T) {
3199
3212
frameworkruntime .WithInformerFactory (informerFactory ),
3200
3213
frameworkruntime .WithSnapshotSharedLister (snapshot ),
3201
3214
frameworkruntime .WithClientSet (client ),
3202
- frameworkruntime .WithPodNominator (internalqueue .NewTestPodNominator ( informerFactory . Core (). V1 (). Pods (). Lister () )),
3215
+ frameworkruntime .WithPodNominator (internalqueue .NewSchedulingQueue ( nil , informerFactory )),
3203
3216
)
3204
3217
if err != nil {
3205
3218
t .Fatalf ("error creating framework: %+v" , err )
@@ -3317,7 +3330,7 @@ func TestFairEvaluationForNodes(t *testing.T) {
3317
3330
tf .RegisterBindPlugin (defaultbinder .Name , defaultbinder .New ),
3318
3331
},
3319
3332
"" ,
3320
- frameworkruntime .WithPodNominator (internalqueue .NewTestPodNominator ( nil )),
3333
+ frameworkruntime .WithPodNominator (internalqueue .NewTestQueue ( ctx , nil )),
3321
3334
)
3322
3335
if err != nil {
3323
3336
t .Fatal (err )
@@ -3399,7 +3412,7 @@ func TestPreferNominatedNodeFilterCallCounts(t *testing.T) {
3399
3412
ctx ,
3400
3413
registerPlugins , "" ,
3401
3414
frameworkruntime .WithClientSet (client ),
3402
- frameworkruntime .WithPodNominator (internalqueue .NewTestPodNominator ( informerFactory . Core (). V1 (). Pods (). Lister () )),
3415
+ frameworkruntime .WithPodNominator (internalqueue .NewSchedulingQueue ( nil , informerFactory )),
3403
3416
)
3404
3417
if err != nil {
3405
3418
t .Fatal (err )
@@ -3557,7 +3570,7 @@ func setupTestScheduler(ctx context.Context, t *testing.T, queuedPodStore *clien
3557
3570
frameworkruntime .WithClientSet (client ),
3558
3571
frameworkruntime .WithEventRecorder (recorder ),
3559
3572
frameworkruntime .WithInformerFactory (informerFactory ),
3560
- frameworkruntime .WithPodNominator (internalqueue . NewTestPodNominator ( informerFactory . Core (). V1 (). Pods (). Lister ()) ),
3573
+ frameworkruntime .WithPodNominator (schedulingQueue ),
3561
3574
frameworkruntime .WithWaitingPods (waitingPods ),
3562
3575
)
3563
3576
0 commit comments