@@ -86,8 +86,7 @@ func TestConfigWithoutVerifier(t *testing.T) {
8686 }
8787
8888 // setup a cancelable context so the monitor goroutine gets shutdown.
89- ctx , cancel := context .WithCancel (context .Background ())
90- defer cancel ()
89+ ctx := t .Context ()
9190
9291 w := fakeWatchingSource {fakeSource : fakeSource {outVal : foozleConfig }}
9392 d , err := Config (ctx , & base , & fakeSource {outVal : emptyConf }, & w )
@@ -150,8 +149,7 @@ func TestConfigWithFailVerifier(t *testing.T) {
150149 }
151150
152151 // setup a cancelable context so the monitor goroutine gets shutdown.
153- ctx , cancel := context .WithCancel (context .Background ())
154- defer cancel ()
152+ ctx := t .Context ()
155153
156154 w := fakeWatchingSource {fakeSource : fakeSource {outVal : foozleConfig }}
157155 _ , err := Config (ctx , & base , & fakeSource {outVal : emptyConf }, & w )
@@ -184,8 +182,7 @@ func TestConfigWithSkippedInitialVerify(t *testing.T) {
184182 }
185183
186184 // setup a cancelable context so the monitor goroutine gets shutdown.
187- ctx , cancel := context .WithCancel (context .Background ())
188- defer cancel ()
185+ ctx := t .Context ()
189186
190187 w := fakeWatchingSource {fakeSource : fakeSource {outVal : foozleConfig }}
191188 _ , err := Params [testConfig ]{
@@ -218,8 +215,7 @@ func TestConfigWithDelayInitialVerifyFailNoWatch(t *testing.T) {
218215 }
219216
220217 // setup a cancelable context so the monitor goroutine gets shutdown.
221- ctx , cancel := context .WithCancel (context .Background ())
222- defer cancel ()
218+ ctx := t .Context ()
223219
224220 s := fakeSource {outVal : foozleConfig }
225221 d , err := Params [testConfig ]{
@@ -257,8 +253,7 @@ func TestConfigWithDelayInitialVerifyFailWatchNoGlobalCBSuppress(t *testing.T) {
257253 }
258254
259255 // setup a cancelable context so the monitor goroutine gets shutdown.
260- ctx , cancel := context .WithCancel (context .Background ())
261- defer cancel ()
256+ ctx := t .Context ()
262257
263258 globalCfgCh := make (chan * configurableVerifier , 1 )
264259 w := fakeWatchingSource {fakeSource : fakeSource {outVal : foozleConfig }}
@@ -313,8 +308,7 @@ func TestConfigWithDelayInitialVerifyFailWatchlobalCBSuppress(t *testing.T) {
313308 }
314309
315310 // setup a cancelable context so the monitor goroutine gets shutdown.
316- ctx , cancel := context .WithCancel (context .Background ())
317- defer cancel ()
311+ ctx := t .Context ()
318312
319313 errCBCh := make (chan error , 1 )
320314 expglobalCBCall := make (chan struct {})
@@ -426,8 +420,7 @@ func TestConfigWithSuccessVerifier(t *testing.T) {
426420 }
427421
428422 // setup a cancelable context so the monitor goroutine gets shutdown.
429- ctx , cancel := context .WithCancel (context .Background ())
430- defer cancel ()
423+ ctx := t .Context ()
431424
432425 w := fakeWatchingSource {fakeSource : fakeSource {outVal : foozleConfig }}
433426 d , err := Config (ctx , & base , & fakeSource {outVal : emptyConf }, & w )
@@ -502,8 +495,7 @@ func TestConfigWithConfigureVerifier(t *testing.T) {
502495 }
503496
504497 // setup a cancelable context so the monitor goroutine gets shutdown.
505- ctx , cancel := context .WithCancel (context .Background ())
506- defer cancel ()
498+ ctx := t .Context ()
507499
508500 errCh := make (chan error , 1 )
509501 params := Params [configurableVerifier ]{
@@ -588,8 +580,7 @@ func TestWatcherWithDoneAndErrorCallback(t *testing.T) {
588580 }
589581
590582 // setup a cancelable context so the monitor goroutine gets shutdown.
591- ctx , cancel := context .WithCancel (context .Background ())
592- defer cancel ()
583+ ctx := t .Context ()
593584
594585 reportedErrCh := make (chan error )
595586 p := Params [testConfig ]{
@@ -673,8 +664,7 @@ func TestConfigWithNewConfigCallbacks(t *testing.T) {
673664 }
674665
675666 // setup a cancelable context so the monitor goroutine gets shutdown.
676- ctx , cancel := context .WithCancel (context .Background ())
677- defer cancel ()
667+ ctx := t .Context ()
678668
679669 oldConf := make (chan * testConfig , 1 )
680670 newConf := make (chan * testConfig )
@@ -792,8 +782,7 @@ func TestConfigWithNewConfigCallbacksSaturate(t *testing.T) {
792782 }
793783
794784 // setup a cancelable context so the monitor goroutine gets shutdown.
795- ctx , cancel := context .WithCancel (context .Background ())
796- defer cancel ()
785+ ctx := t .Context ()
797786
798787 // give oldConf a large capacity (we don't want to block on both)
799788 oldConf := make (chan * testConfig , 128 )
0 commit comments