@@ -46,16 +46,16 @@ func TestOn(t *testing.T) {
4646 }
4747 // create pod
4848 for _ , pod := range pods {
49- assert .Nil (t , fakeClient .Create (context .TODO (), pod ))
49+ assert .Nil (t , fakeClient .Create (context .Background (), pod ))
5050 }
5151 defer cleanPods (fakeClient , pods )
5252
53- err := readinessGate .On (context .TODO (), pods )
53+ err := readinessGate .On (context .Background (), pods )
5454 assert .Nil (t , err )
5555
5656 podList := & corev1.PodList {}
5757 ls , _ := labels .Parse ("foo=bar" )
58- assert .Nil (t , fakeClient .List (context .TODO (), podList , & client.ListOptions {LabelSelector : ls }))
58+ assert .Nil (t , fakeClient .List (context .Background (), podList , & client.ListOptions {LabelSelector : ls }))
5959
6060 for _ , pod := range podList .Items {
6161 assert .NotNil (t , pod .Status , "pod status should not nil for %s" , pod .Name )
@@ -83,16 +83,16 @@ func TestOff(t *testing.T) {
8383
8484 // create pod
8585 for _ , pod := range pods {
86- assert .Nil (t , fakeClient .Create (context .TODO (), pod ))
86+ assert .Nil (t , fakeClient .Create (context .Background (), pod ))
8787 }
8888 defer cleanPods (fakeClient , pods )
8989
90- err := readinessGate .Off (context .TODO (), pods )
90+ err := readinessGate .Off (context .Background (), pods )
9191 assert .Nil (t , err )
9292
9393 podList := & corev1.PodList {}
9494 ls , _ := labels .Parse ("foo=bar" )
95- assert .Nil (t , fakeClient .List (context .TODO (), podList , & client.ListOptions {LabelSelector : ls }))
95+ assert .Nil (t , fakeClient .List (context .Background (), podList , & client.ListOptions {LabelSelector : ls }))
9696
9797 for _ , pod := range podList .Items {
9898 assert .NotNil (t , pod .Status , "pod status should not nil for %s" , pod .Name )
@@ -113,6 +113,6 @@ func hasExpectedTraffic(conditions []corev1.PodCondition, expectedStatus corev1.
113113
114114func cleanPods (c client.Client , pods []* corev1.Pod ) {
115115 for _ , pod := range pods {
116- _ = c .Delete (context .TODO (), pod )
116+ _ = c .Delete (context .Background (), pod )
117117 }
118118}
0 commit comments