mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 19:58:17 +00:00
Avoid to use deprecated wait.Poll in scheduler tests
Signed-off-by: kerthcet <kerthcet@gmail.com>
This commit is contained in:
@@ -681,7 +681,7 @@ func TestPreFilterPlugin(t *testing.T) {
|
||||
}
|
||||
|
||||
if test.reject {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.ClientSet, pod); err != nil {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.Ctx, testCtx.ClientSet, pod); err != nil {
|
||||
t.Errorf("Didn't expect the pod to be scheduled. error: %v", err)
|
||||
}
|
||||
} else if test.fail {
|
||||
@@ -1152,7 +1152,7 @@ func TestPrebindPlugin(t *testing.T) {
|
||||
t.Errorf("Expected a scheduling error, but didn't get it. error: %v", err)
|
||||
}
|
||||
} else if test.reject {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.ClientSet, pod); err != nil {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.Ctx, testCtx.ClientSet, pod); err != nil {
|
||||
t.Errorf("Expected the pod to be unschedulable")
|
||||
}
|
||||
} else if err = testutils.WaitForPodToSchedule(testCtx.ClientSet, pod); err != nil {
|
||||
@@ -1384,7 +1384,7 @@ func TestUnReservePermitPlugins(t *testing.T) {
|
||||
}
|
||||
|
||||
if test.reject {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.ClientSet, pod); err != nil {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.Ctx, testCtx.ClientSet, pod); err != nil {
|
||||
t.Errorf("Didn't expect the pod to be scheduled. error: %v", err)
|
||||
}
|
||||
|
||||
@@ -1456,7 +1456,7 @@ func TestUnReservePreBindPlugins(t *testing.T) {
|
||||
}
|
||||
|
||||
if test.wantReject {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.ClientSet, pod); err != nil {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.Ctx, testCtx.ClientSet, pod); err != nil {
|
||||
t.Errorf("Expected a reasons other than Unschedulable, but got: %v", err)
|
||||
}
|
||||
|
||||
@@ -1902,7 +1902,7 @@ func TestPermitPlugin(t *testing.T) {
|
||||
}
|
||||
} else {
|
||||
if test.reject || test.timeout {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.ClientSet, pod); err != nil {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.Ctx, testCtx.ClientSet, pod); err != nil {
|
||||
t.Errorf("Didn't expect the pod to be scheduled. error: %v", err)
|
||||
}
|
||||
} else {
|
||||
@@ -2068,10 +2068,10 @@ func TestCoSchedulingWithPermitPlugin(t *testing.T) {
|
||||
}
|
||||
|
||||
if test.waitReject {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.ClientSet, podA); err != nil {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.Ctx, testCtx.ClientSet, podA); err != nil {
|
||||
t.Errorf("Didn't expect the first pod to be scheduled. error: %v", err)
|
||||
}
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.ClientSet, podB); err != nil {
|
||||
if err = testutils.WaitForPodUnschedulable(testCtx.Ctx, testCtx.ClientSet, podB); err != nil {
|
||||
t.Errorf("Didn't expect the second pod to be scheduled. error: %v", err)
|
||||
}
|
||||
if !((permitPlugin.waitingPod == podA.Name && permitPlugin.rejectingPod == podB.Name) ||
|
||||
@@ -2263,7 +2263,7 @@ func TestPreEnqueuePlugin(t *testing.T) {
|
||||
t.Errorf("Expected the enqueuePlugin plugin to be called at least once, but got 0")
|
||||
}
|
||||
} else {
|
||||
if err := testutils.WaitForPodSchedulingGated(testCtx.ClientSet, pod, 10*time.Second); err != nil {
|
||||
if err := testutils.WaitForPodSchedulingGated(testCtx.Ctx, testCtx.ClientSet, pod, 10*time.Second); err != nil {
|
||||
t.Errorf("Expected the pod to be scheduling waiting, but got: %v", err)
|
||||
}
|
||||
// Also verify preFilterPlugin is not called.
|
||||
@@ -2575,7 +2575,7 @@ func TestActivatePods(t *testing.T) {
|
||||
|
||||
// Wait for the 2 executor pods to be unschedulable.
|
||||
for _, pod := range pods {
|
||||
if err := testutils.WaitForPodUnschedulable(cs, pod); err != nil {
|
||||
if err := testutils.WaitForPodUnschedulable(testCtx.Ctx, cs, pod); err != nil {
|
||||
t.Errorf("Failed to wait for Pod %v to be unschedulable: %v", pod.Name, err)
|
||||
}
|
||||
}
|
||||
@@ -2721,7 +2721,7 @@ func TestSchedulingGatesPluginEventsToRegister(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := testutils.WaitForPodSchedulingGated(testCtx.ClientSet, gatedPod, 10*time.Second); err != nil {
|
||||
if err := testutils.WaitForPodSchedulingGated(testCtx.Ctx, testCtx.ClientSet, gatedPod, 10*time.Second); err != nil {
|
||||
t.Errorf("Expected the pod to be gated, but got: %v", err)
|
||||
return
|
||||
}
|
||||
@@ -2761,7 +2761,7 @@ func TestSchedulingGatesPluginEventsToRegister(t *testing.T) {
|
||||
}
|
||||
|
||||
// Pod should still be unschedulable because scheduling gates still exist, theoretically, it's a waste rescheduling.
|
||||
if err := testutils.WaitForPodSchedulingGated(testCtx.ClientSet, gatedPod, 10*time.Second); err != nil {
|
||||
if err := testutils.WaitForPodSchedulingGated(testCtx.Ctx, testCtx.ClientSet, gatedPod, 10*time.Second); err != nil {
|
||||
t.Errorf("Expected the pod to be gated, but got: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user