@@ -43,8 +43,7 @@ func TestPollUntil(t *testing.T) {
4343}
4444
4545func TestPollUntil_HandlesError (t * testing.T ) {
46- ctx , cancel := context .WithCancel (context .Background ())
47- defer cancel ()
46+ ctx := t .Context ()
4847
4948 var count int
5049 err := wait .PollUntil (ctx , func (context.Context ) (done bool , err error ) {
@@ -59,8 +58,7 @@ func TestPollUntil_HandlesError(t *testing.T) {
5958}
6059
6160func TestPollUntil_HandlesDone (t * testing.T ) {
62- ctx , cancel := context .WithCancel (context .Background ())
63- defer cancel ()
61+ ctx := t .Context ()
6462
6563 var count int
6664 err := wait .PollUntil (ctx , func (context.Context ) (done bool , err error ) {
@@ -107,8 +105,7 @@ func TestPollImmediateUntil(t *testing.T) {
107105}
108106
109107func TestPollImmediateUntil_HandlesImmediateError (t * testing.T ) {
110- ctx , cancel := context .WithCancel (context .Background ())
111- defer cancel ()
108+ ctx := t .Context ()
112109
113110 err := wait .PollImmediateUntil (ctx , func (context.Context ) (done bool , err error ) {
114111 return false , errors .New ("test" )
@@ -118,8 +115,7 @@ func TestPollImmediateUntil_HandlesImmediateError(t *testing.T) {
118115}
119116
120117func TestPollImmediateUntil_HandlesImmediateDone (t * testing.T ) {
121- ctx , cancel := context .WithCancel (context .Background ())
122- defer cancel ()
118+ ctx := t .Context ()
123119
124120 err := wait .PollImmediateUntil (ctx , func (context.Context ) (done bool , err error ) {
125121 return true , nil
0 commit comments