@@ -5287,7 +5287,7 @@ func TestSyncJobUpdateRequeue(t *testing.T) {
5287
5287
job := newJob (2 , 2 , 6 , batch .NonIndexedCompletion )
5288
5288
sharedInformerFactory .Batch ().V1 ().Jobs ().Informer ().GetIndexer ().Add (job )
5289
5289
manager .queue .Add (testutil .GetKey (job , t ))
5290
- manager .processNextWorkItem (context . TODO () )
5290
+ manager .processNextWorkItem (ctx )
5291
5291
if tc .wantRequeued {
5292
5292
verifyEmptyQueueAndAwaitForQueueLen (ctx , t , manager , 1 )
5293
5293
} else {
@@ -5297,7 +5297,7 @@ func TestSyncJobUpdateRequeue(t *testing.T) {
5297
5297
// into the queue asynchronously.
5298
5298
manager .clock .Sleep (fastJobApiBackoff )
5299
5299
time .Sleep (time .Millisecond )
5300
- verifyEmptyQueue (ctx , t , manager )
5300
+ verifyEmptyQueue (t , manager )
5301
5301
}
5302
5302
})
5303
5303
}
@@ -5570,7 +5570,7 @@ func TestGetPodsForJob(t *testing.T) {
5570
5570
informer .Core ().V1 ().Pods ().Informer ().GetIndexer ().Add (p )
5571
5571
}
5572
5572
5573
- pods , err := jm .getPodsForJob (context . TODO () , job )
5573
+ pods , err := jm .getPodsForJob (ctx , job )
5574
5574
if err != nil {
5575
5575
t .Fatalf ("getPodsForJob() error: %v" , err )
5576
5576
}
@@ -5961,7 +5961,7 @@ func TestWatchJobs(t *testing.T) {
5961
5961
stopCh := make (chan struct {})
5962
5962
defer close (stopCh )
5963
5963
sharedInformerFactory .Start (stopCh )
5964
- go manager .Run (context . TODO () , 1 )
5964
+ go manager .Run (ctx , 1 )
5965
5965
5966
5966
// We're sending new job to see if it reaches syncHandler.
5967
5967
testJob .Namespace = "bar"
@@ -6008,7 +6008,7 @@ func TestWatchPods(t *testing.T) {
6008
6008
stopCh := make (chan struct {})
6009
6009
defer close (stopCh )
6010
6010
go sharedInformerFactory .Core ().V1 ().Pods ().Informer ().Run (stopCh )
6011
- go manager .Run (context . TODO () , 1 )
6011
+ go manager .Run (ctx , 1 )
6012
6012
6013
6013
pods := newPodList (1 , v1 .PodRunning , testJob )
6014
6014
testPod := pods [0 ]
@@ -6035,7 +6035,7 @@ func TestWatchOrphanPods(t *testing.T) {
6035
6035
podInformer := sharedInformers .Core ().V1 ().Pods ().Informer ()
6036
6036
go podInformer .Run (stopCh )
6037
6037
cache .WaitForCacheSync (stopCh , podInformer .HasSynced )
6038
- go manager .Run (context . TODO () , 1 )
6038
+ go manager .Run (ctx , 1 )
6039
6039
6040
6040
// Create job but don't add it to the store.
6041
6041
cases := map [string ]struct {
@@ -6297,7 +6297,7 @@ func TestJobApiBackoffReset(t *testing.T) {
6297
6297
// error returned make the key requeued
6298
6298
fakePodControl .Err = errors .New ("Controller error" )
6299
6299
manager .queue .Add (key )
6300
- manager .processNextWorkItem (context . TODO () )
6300
+ manager .processNextWorkItem (ctx )
6301
6301
retries := manager .queue .NumRequeues (key )
6302
6302
if retries != 1 {
6303
6303
t .Fatalf ("%s: expected exactly 1 retry, got %d" , job .Name , retries )
@@ -6307,8 +6307,8 @@ func TestJobApiBackoffReset(t *testing.T) {
6307
6307
6308
6308
// the queue is emptied on success
6309
6309
fakePodControl .Err = nil
6310
- manager .processNextWorkItem (context . TODO () )
6311
- verifyEmptyQueue (ctx , t , manager )
6310
+ manager .processNextWorkItem (ctx )
6311
+ verifyEmptyQueue (t , manager )
6312
6312
}
6313
6313
6314
6314
var _ workqueue.TypedRateLimitingInterface [string ] = & fakeRateLimitingQueue {}
@@ -7091,13 +7091,13 @@ func podReplacementPolicy(m batch.PodReplacementPolicy) *batch.PodReplacementPol
7091
7091
7092
7092
func verifyEmptyQueueAndAwaitForQueueLen (ctx context.Context , t * testing.T , jm * Controller , wantQueueLen int ) {
7093
7093
t .Helper ()
7094
- verifyEmptyQueue (ctx , t , jm )
7094
+ verifyEmptyQueue (t , jm )
7095
7095
awaitForQueueLen (ctx , t , jm , wantQueueLen )
7096
7096
}
7097
7097
7098
7098
func awaitForQueueLen (ctx context.Context , t * testing.T , jm * Controller , wantQueueLen int ) {
7099
7099
t .Helper ()
7100
- verifyEmptyQueue (ctx , t , jm )
7100
+ verifyEmptyQueue (t , jm )
7101
7101
if err := wait .PollUntilContextTimeout (ctx , fastRequeue , time .Second , true , func (ctx context.Context ) (bool , error ) {
7102
7102
if requeued := jm .queue .Len () == wantQueueLen ; requeued {
7103
7103
return true , nil
@@ -7109,7 +7109,7 @@ func awaitForQueueLen(ctx context.Context, t *testing.T, jm *Controller, wantQue
7109
7109
}
7110
7110
}
7111
7111
7112
- func verifyEmptyQueue (ctx context. Context , t * testing.T , jm * Controller ) {
7112
+ func verifyEmptyQueue (t * testing.T , jm * Controller ) {
7113
7113
t .Helper ()
7114
7114
if jm .queue .Len () > 0 {
7115
7115
t .Errorf ("Unexpected queue.Len(). Want: %d, got: %d" , 0 , jm .queue .Len ())
0 commit comments