@@ -693,7 +693,7 @@ func TestPreFilterPlugin(t *testing.T) {
693
693
t .Errorf ("Expected a scheduling error, but got: %v" , err )
694
694
}
695
695
} else {
696
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
696
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
697
697
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
698
698
}
699
699
}
@@ -873,7 +873,7 @@ func TestPostFilterPlugin(t *testing.T) {
873
873
t .Errorf ("Expected the score plugin to be called at least %v times, but got %v." , tt .expectScoreNumCalled , numScoreCalled )
874
874
}
875
875
} else {
876
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
876
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
877
877
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
878
878
}
879
879
if numFilterCalled := filterPlugin .deepCopy ().numFilterCalled ; numFilterCalled != tt .expectFilterNumCalled {
@@ -935,7 +935,7 @@ func TestScorePlugin(t *testing.T) {
935
935
t .Errorf ("Expected a scheduling error, but got: %v" , err )
936
936
}
937
937
} else {
938
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
938
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
939
939
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
940
940
} else {
941
941
p , err := testutils .GetPod (testCtx .ClientSet , pod .Name , pod .Namespace )
@@ -971,7 +971,7 @@ func TestNormalizeScorePlugin(t *testing.T) {
971
971
t .Fatalf ("Error while creating a test pod: %v" , err )
972
972
}
973
973
974
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
974
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
975
975
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
976
976
}
977
977
@@ -1027,7 +1027,7 @@ func TestReservePluginReserve(t *testing.T) {
1027
1027
t .Errorf ("Didn't expect the pod to be scheduled. error: %v" , err )
1028
1028
}
1029
1029
} else {
1030
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1030
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1031
1031
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
1032
1032
}
1033
1033
}
@@ -1147,7 +1147,7 @@ func TestPrebindPlugin(t *testing.T) {
1147
1147
1148
1148
if test .fail {
1149
1149
if test .succeedOnRetry {
1150
- if err = testutils .WaitForPodToScheduleWithTimeout (testCtx .ClientSet , pod , 10 * time .Second ); err != nil {
1150
+ if err = testutils .WaitForPodToScheduleWithTimeout (testCtx .Ctx , testCtx . ClientSet , pod , 10 * time .Second ); err != nil {
1151
1151
t .Errorf ("Expected the pod to be schedulable on retry, but got an error: %v" , err )
1152
1152
}
1153
1153
} else if err = wait .PollUntilContextTimeout (testCtx .Ctx , 10 * time .Millisecond , 30 * time .Second , false ,
@@ -1158,7 +1158,7 @@ func TestPrebindPlugin(t *testing.T) {
1158
1158
if err = testutils .WaitForPodUnschedulable (testCtx .Ctx , testCtx .ClientSet , pod ); err != nil {
1159
1159
t .Errorf ("Expected the pod to be unschedulable" )
1160
1160
}
1161
- } else if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1161
+ } else if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1162
1162
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
1163
1163
}
1164
1164
@@ -1314,7 +1314,7 @@ func TestUnReserveReservePlugins(t *testing.T) {
1314
1314
}
1315
1315
}
1316
1316
} else {
1317
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1317
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1318
1318
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
1319
1319
}
1320
1320
@@ -1396,7 +1396,7 @@ func TestUnReservePermitPlugins(t *testing.T) {
1396
1396
t .Errorf ("Reserve Plugin %s numUnreserveCalled = %d, want 1." , reservePlugin .name , reservePlugin .numUnreserveCalled )
1397
1397
}
1398
1398
} else {
1399
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1399
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1400
1400
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
1401
1401
}
1402
1402
@@ -1468,7 +1468,7 @@ func TestUnReservePreBindPlugins(t *testing.T) {
1468
1468
t .Errorf ("Reserve Plugin %s numUnreserveCalled = %d, want 1." , reservePlugin .name , reservePlugin .numUnreserveCalled )
1469
1469
}
1470
1470
} else {
1471
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1471
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1472
1472
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
1473
1473
}
1474
1474
@@ -1540,7 +1540,7 @@ func TestUnReserveBindPlugins(t *testing.T) {
1540
1540
t .Errorf ("Reserve Plugin %s numUnreserveCalled = %d, want 1." , reservePlugin .name , reservePlugin .numUnreserveCalled )
1541
1541
}
1542
1542
} else {
1543
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1543
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1544
1544
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
1545
1545
}
1546
1546
@@ -1688,7 +1688,7 @@ func TestBindPlugin(t *testing.T) {
1688
1688
1689
1689
if test .expectBoundByScheduler || test .expectBoundByPlugin {
1690
1690
// bind plugins skipped to bind the pod
1691
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1691
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1692
1692
t .Fatalf ("Expected the pod to be scheduled. error: %v" , err )
1693
1693
}
1694
1694
pod , err = testCtx .ClientSet .CoreV1 ().Pods (pod .Namespace ).Get (testCtx .Ctx , pod .Name , metav1.GetOptions {})
@@ -1810,7 +1810,7 @@ func TestPostBindPlugin(t *testing.T) {
1810
1810
t .Errorf ("Didn't expect the postbind plugin to be called %d times." , postBindPlugin .numPostBindCalled )
1811
1811
}
1812
1812
} else {
1813
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1813
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1814
1814
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
1815
1815
}
1816
1816
select {
@@ -1909,7 +1909,7 @@ func TestPermitPlugin(t *testing.T) {
1909
1909
t .Errorf ("Didn't expect the pod to be scheduled. error: %v" , err )
1910
1910
}
1911
1911
} else {
1912
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1912
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1913
1913
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
1914
1914
}
1915
1915
}
@@ -1966,7 +1966,7 @@ func TestMultiplePermitPlugins(t *testing.T) {
1966
1966
}
1967
1967
1968
1968
perPlugin2 .allowAllPods ()
1969
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
1969
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
1970
1970
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
1971
1971
}
1972
1972
@@ -2083,10 +2083,10 @@ func TestCoSchedulingWithPermitPlugin(t *testing.T) {
2083
2083
permitPlugin .waitingPod , permitPlugin .rejectingPod )
2084
2084
}
2085
2085
} else {
2086
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , podA ); err != nil {
2086
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , podA ); err != nil {
2087
2087
t .Errorf ("Expected the first pod to be scheduled. error: %v" , err )
2088
2088
}
2089
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , podB ); err != nil {
2089
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , podB ); err != nil {
2090
2090
t .Errorf ("Expected the second pod to be scheduled. error: %v" , err )
2091
2091
}
2092
2092
if ! ((permitPlugin .waitingPod == podA .Name && permitPlugin .allowingPod == podB .Name ) ||
@@ -2150,7 +2150,7 @@ func TestFilterPlugin(t *testing.T) {
2150
2150
t .Errorf ("Expected the filter plugin to be called at least 1 time, but got %v." , filterPlugin .numFilterCalled )
2151
2151
}
2152
2152
} else {
2153
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
2153
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
2154
2154
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
2155
2155
}
2156
2156
if filterPlugin .numFilterCalled != 1 {
@@ -2204,7 +2204,7 @@ func TestPreScorePlugin(t *testing.T) {
2204
2204
t .Errorf ("Expected a scheduling error, but got: %v" , err )
2205
2205
}
2206
2206
} else {
2207
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , pod ); err != nil {
2207
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , pod ); err != nil {
2208
2208
t .Errorf ("Expected the pod to be scheduled. error: %v" , err )
2209
2209
}
2210
2210
}
@@ -2258,7 +2258,7 @@ func TestPreEnqueuePlugin(t *testing.T) {
2258
2258
}
2259
2259
2260
2260
if tt .admitEnqueue {
2261
- if err := testutils .WaitForPodToScheduleWithTimeout (testCtx .ClientSet , pod , 10 * time .Second ); err != nil {
2261
+ if err := testutils .WaitForPodToScheduleWithTimeout (testCtx .Ctx , testCtx . ClientSet , pod , 10 * time .Second ); err != nil {
2262
2262
t .Errorf ("Expected the pod to be schedulable, but got: %v" , err )
2263
2263
}
2264
2264
// Also verify enqueuePlugin is called.
@@ -2396,7 +2396,7 @@ func TestPreemptWithPermitPlugin(t *testing.T) {
2396
2396
t .Fatalf ("Error while creating the running pod: %v" , err )
2397
2397
}
2398
2398
// Wait until the pod to be scheduled.
2399
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , r ); err != nil {
2399
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , r ); err != nil {
2400
2400
t .Fatalf ("The running pod is expected to be scheduled: %v" , err )
2401
2401
}
2402
2402
}
@@ -2425,7 +2425,7 @@ func TestPreemptWithPermitPlugin(t *testing.T) {
2425
2425
t .Fatalf ("Error while deleting the waiting pod: %v" , err )
2426
2426
}
2427
2427
}
2428
- if err = testutils .WaitForPodToSchedule (testCtx .ClientSet , p ); err != nil {
2428
+ if err = testutils .WaitForPodToSchedule (testCtx .Ctx , testCtx . ClientSet , p ); err != nil {
2429
2429
t .Fatalf ("Expected the preemptor pod to be scheduled. error: %v" , err )
2430
2430
}
2431
2431
}
@@ -2592,7 +2592,7 @@ func TestActivatePods(t *testing.T) {
2592
2592
2593
2593
// Verify all pods to be scheduled.
2594
2594
for _ , pod := range pods {
2595
- if err := testutils .WaitForPodToScheduleWithTimeout (cs , pod , wait .ForeverTestTimeout ); err != nil {
2595
+ if err := testutils .WaitForPodToScheduleWithTimeout (testCtx . Ctx , cs , pod , wait .ForeverTestTimeout ); err != nil {
2596
2596
t .Fatalf ("Failed to wait for Pod %v to be schedulable: %v" , pod .Name , err )
2597
2597
}
2598
2598
}
@@ -2768,7 +2768,7 @@ func TestPreEnqueuePluginEventsToRegister(t *testing.T) {
2768
2768
}
2769
2769
2770
2770
// Wait for the pod schedulabled.
2771
- if err := testutils .WaitForPodToScheduleWithTimeout (testCtx .ClientSet , pausePod , 10 * time .Second ); err != nil {
2771
+ if err := testutils .WaitForPodToScheduleWithTimeout (testCtx .Ctx , testCtx . ClientSet , pausePod , 10 * time .Second ); err != nil {
2772
2772
t .Errorf ("Expected the pod to be schedulable, but got: %v" , err )
2773
2773
return
2774
2774
}
@@ -2810,7 +2810,7 @@ func TestPreEnqueuePluginEventsToRegister(t *testing.T) {
2810
2810
}
2811
2811
2812
2812
if expectedScheduled {
2813
- if err := testutils .WaitForPodToScheduleWithTimeout (testCtx .ClientSet , gatedPod , 10 * time .Second ); err != nil {
2813
+ if err := testutils .WaitForPodToScheduleWithTimeout (testCtx .Ctx , testCtx . ClientSet , gatedPod , 10 * time .Second ); err != nil {
2814
2814
t .Errorf ("Expected the pod to be schedulable, but got: %v" , err )
2815
2815
}
2816
2816
return
0 commit comments