@@ -73,8 +73,7 @@ func TestAsyncBlockRetriever_SubscriptionDrivenCaching(t *testing.T) {
7373 logger := zerolog .Nop ()
7474 fetcher := NewAsyncBlockRetriever (client , logger , fiNs , 200 * time .Millisecond , 100 , 5 )
7575
76- ctx , cancel := context .WithCancel (context .Background ())
77- defer cancel ()
76+ ctx := t .Context ()
7877 fetcher .Start (ctx )
7978 defer fetcher .Stop ()
8079
@@ -128,8 +127,7 @@ func TestAsyncBlockRetriever_CatchupFillsGaps(t *testing.T) {
128127 logger := zerolog .Nop ()
129128 fetcher := NewAsyncBlockRetriever (client , logger , fiNs , 100 * time .Millisecond , 100 , 10 )
130129
131- ctx , cancel := context .WithCancel (context .Background ())
132- defer cancel ()
130+ ctx := t .Context ()
133131 fetcher .Start (ctx )
134132 defer fetcher .Stop ()
135133
@@ -198,8 +196,7 @@ func TestAsyncBlockRetriever_StopGracefully(t *testing.T) {
198196 logger := zerolog .Nop ()
199197 fetcher := NewAsyncBlockRetriever (client , logger , fiNs , 100 * time .Millisecond , 100 , 10 )
200198
201- ctx , cancel := context .WithCancel (context .Background ())
202- defer cancel ()
199+ ctx := t .Context ()
203200 fetcher .Start (ctx )
204201 time .Sleep (100 * time .Millisecond )
205202
@@ -240,8 +237,7 @@ func TestAsyncBlockRetriever_ReconnectOnSubscriptionError(t *testing.T) {
240237 // Very short backoff so reconnect is fast in tests.
241238 fetcher := NewAsyncBlockRetriever (client , logger , fiNs , 50 * time .Millisecond , 100 , 5 )
242239
243- ctx , cancel := context .WithCancel (context .Background ())
244- defer cancel ()
240+ ctx := t .Context ()
245241 fetcher .Start (ctx )
246242 defer fetcher .Stop ()
247243
0 commit comments