kube-scheduler: convert the remaining part to use contextual logging

This commit is contained in:
Mengjiao Liu
2023-09-29 10:59:22 +08:00
parent 9ae55e9886
commit b0a73213d6
14 changed files with 95 additions and 85 deletions

View File

@@ -1145,10 +1145,11 @@ func NextPodOrDie(t *testing.T, testCtx *TestContext) *schedulerframework.Queued
t.Helper()
var podInfo *schedulerframework.QueuedPodInfo
logger := klog.FromContext(testCtx.Ctx)
// NextPod() is a blocking operation. Wrap it in timeout() to avoid relying on
// default go testing timeout (10m) to abort.
if err := timeout(testCtx.Ctx, time.Second*5, func() {
podInfo, _ = testCtx.Scheduler.NextPod()
podInfo, _ = testCtx.Scheduler.NextPod(logger)
}); err != nil {
t.Fatalf("Timed out waiting for the Pod to be popped: %v", err)
}
@@ -1160,10 +1161,11 @@ func NextPod(t *testing.T, testCtx *TestContext) *schedulerframework.QueuedPodIn
t.Helper()
var podInfo *schedulerframework.QueuedPodInfo
logger := klog.FromContext(testCtx.Ctx)
// NextPod() is a blocking operation. Wrap it in timeout() to avoid relying on
// default go testing timeout (10m) to abort.
if err := timeout(testCtx.Ctx, time.Second*5, func() {
podInfo, _ = testCtx.Scheduler.NextPod()
podInfo, _ = testCtx.Scheduler.NextPod(logger)
}); err != nil {
return nil
}