@@ -27,6 +27,7 @@ import (
2727 "testing"
2828 "time"
2929
30+ "github.com/go-logr/logr"
3031 "github.com/stretchr/testify/assert"
3132 corev1 "k8s.io/api/core/v1"
3233 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -1049,8 +1050,7 @@ func TestFairness(t *testing.T) {
10491050 assert .NoError (t , err )
10501051 eventBroadcaster .StartRecordingToSink (ctx .Done ())
10511052 suit .start ()
1052- logger := klog .FromContext (ctx )
1053- sched .SchedulingQueue .Run (logger )
1053+ sched .SchedulingQueue .Run (logr .Discard ())
10541054
10551055 var scheduleOrder []* debugPodScheduleInfo
10561056
@@ -1135,7 +1135,7 @@ func simulateScheduleOne(t *testing.T, ctx context.Context, sched *scheduler.Sch
11351135 }
11361136 * scheduleOrder = append (* scheduleOrder , scheduleInfo )
11371137 fwk := suit .Handle .(framework.Framework )
1138- klog .InfoS ("Attempting to schedule pod" , "pod" , klog .KObj (pod ))
1138+ klog .V ( 4 ). InfoS ("Attempting to schedule pod" , "pod" , klog .KObj (pod ))
11391139
11401140 // Synchronously attempt to find a fit for the pod.
11411141 state := framework .NewCycleState ()
@@ -1155,7 +1155,7 @@ func simulateScheduleOne(t *testing.T, ctx context.Context, sched *scheduler.Sch
11551155 // Run PostFilter plugins to try to make the pod schedulable in a future scheduling cycle.
11561156 _ , status := suit .plugin .(* Coscheduling ).PostFilter (ctx , state , pod , fitError .Diagnosis .NodeToStatusMap )
11571157 assert .False (t , status .IsSuccess ())
1158- klog .Info ("sched.Error:" + podInfo .Pod .Name )
1158+ klog .V ( 4 ). Info ("sched.Error:" + podInfo .Pod .Name )
11591159 sched .FailureHandler (ctx , fwk , podInfo , status , & framework.NominatingInfo {}, time.Time {})
11601160 }
11611161 return
@@ -1180,7 +1180,7 @@ func simulateScheduleOne(t *testing.T, ctx context.Context, sched *scheduler.Sch
11801180
11811181 // At the end of a successful scheduling cycle, pop and move up Pods if needed.
11821182 if len (podsToActivate .Map ) != 0 {
1183- sched .SchedulingQueue .Activate (klog . FromContext ( ctx ), podsToActivate .Map )
1183+ sched .SchedulingQueue .Activate (logr . Discard ( ), podsToActivate .Map )
11841184 // Clear the entries after activation.
11851185 podsToActivate .Map = make (map [string ]* corev1.Pod )
11861186 }
@@ -1194,7 +1194,7 @@ func simulateScheduleOne(t *testing.T, ctx context.Context, sched *scheduler.Sch
11941194 if ! waitOnPermitStatus .IsSuccess () {
11951195 // trigger un-reserve plugins to clean up state associated with the reserved Pod
11961196 fwk .RunReservePluginsUnreserve (bindingCycleCtx , state , assumedPod , scheduleResult .SuggestedHost )
1197- klog .Info ("sched.Error:" + assumedPodInfo .Pod .Name )
1197+ klog .V ( 4 ). Info ("sched.Error:" + assumedPodInfo .Pod .Name )
11981198 sched .FailureHandler (ctx , fwk , assumedPodInfo , waitOnPermitStatus , & framework.NominatingInfo {}, time.Time {})
11991199 return
12001200 }
@@ -1204,8 +1204,7 @@ func simulateScheduleOne(t *testing.T, ctx context.Context, sched *scheduler.Sch
12041204
12051205 // At the end of a successful binding cycle, move up Pods if needed.
12061206 if len (podsToActivate .Map ) != 0 {
1207- logger := klog .FromContext (ctx )
1208- sched .SchedulingQueue .Activate (logger , podsToActivate .Map )
1207+ sched .SchedulingQueue .Activate (logr .Discard (), podsToActivate .Map )
12091208 // Unlike the logic in scheduling cycle, we don't bother deleting the entries
12101209 // as `podsToActivate.Map` is no longer consumed.
12111210 }
@@ -1326,7 +1325,7 @@ func TestDeadLockFree(t *testing.T) {
13261325 assert .NoError (t , err )
13271326 eventBroadcaster .StartRecordingToSink (ctx .Done ())
13281327 suit .start ()
1329- sched .SchedulingQueue .Run (klog . FromContext ( ctx ))
1328+ sched .SchedulingQueue .Run (logr . Discard ( ))
13301329
13311330 var scheduleOrder []* debugPodScheduleInfo
13321331
@@ -1445,8 +1444,7 @@ func TestNoRejectWhenInvalidCycle(t *testing.T) {
14451444 assert .NoError (t , err )
14461445 eventBroadcaster .StartRecordingToSink (ctx .Done ())
14471446 suit .start ()
1448- logger := klog .FromContext (ctx )
1449- sched .SchedulingQueue .Run (logger )
1447+ sched .SchedulingQueue .Run (logr .Discard ())
14501448
14511449 var scheduleOrder []* debugPodScheduleInfo
14521450
0 commit comments