Skip to content

Commit e8c5eff

Browse files
committed
context consistency: ensure all context are TODO()
1 parent 07b3bdd commit e8c5eff

10 files changed

Lines changed: 466 additions & 13 deletions

File tree

pkg/controller/deployment/deployment_helper_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ func TestGetOverrideResourcesFor(t *testing.T) {
335335
},
336336
}
337337

338-
ctx, cancel := context.WithCancel(context.Background())
338+
ctx, cancel := context.WithCancel(context.TODO())
339339
defer cancel()
340340

341341
// Create channel to know when the watch has started.
@@ -857,7 +857,7 @@ func TestGetOverrideSchedulingFor(t *testing.T) {
857857
},
858858
}
859859

860-
ctx, cancel := context.WithCancel(context.Background())
860+
ctx, cancel := context.WithCancel(context.TODO())
861861
defer cancel()
862862

863863
// Create channel to know when the watch has started.

pkg/controller/istiocsr/certificates_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func TestCreateOrApplyCertificates(t *testing.T) {
217217
}
218218
r.ctrlClient = mock
219219
istiocsr := &v1alpha1.IstioCSR{}
220-
if err := r.Get(context.Background(), types.NamespacedName{
220+
if err := r.Get(context.TODO(), types.NamespacedName{
221221
Namespace: testIstioCSR().Namespace,
222222
Name: testIstioCSR().Name,
223223
}, istiocsr); err != nil {

pkg/controller/istiocsr/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func New(mgr ctrl.Manager) (*Reconciler, error) {
114114
}
115115
return &Reconciler{
116116
ctrlClient: c,
117-
ctx: context.Background(),
117+
ctx: context.TODO(),
118118
eventRecorder: mgr.GetEventRecorderFor(ControllerName),
119119
log: ctrl.Log.WithName(ControllerName),
120120
scheme: mgr.GetScheme(),

pkg/controller/istiocsr/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ func TestReconcile(t *testing.T) {
417417
}
418418
r.ctrlClient = mock
419419
istiocsr := testIstioCSR()
420-
result, err := r.Reconcile(context.Background(),
420+
result, err := r.Reconcile(context.TODO(),
421421
ctrl.Request{
422422
NamespacedName: types.NamespacedName{Name: istiocsr.GetName(), Namespace: istiocsr.GetNamespace()},
423423
},

pkg/controller/istiocsr/test_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type CertificateTweak func(*x509.Certificate)
4343

4444
func testReconciler(t *testing.T) *Reconciler {
4545
return &Reconciler{
46-
ctx: context.Background(),
46+
ctx: context.TODO(),
4747
eventRecorder: record.NewFakeRecorder(100),
4848
log: testr.New(t),
4949
scheme: library.Scheme,

pkg/operator/informers/externalversions/factory.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)