diff --git a/fetch/fetch_test.go b/fetch/fetch_test.go index 00599bd5d4..8a525ed8c7 100644 --- a/fetch/fetch_test.go +++ b/fetch/fetch_test.go @@ -169,8 +169,6 @@ func TestFetch_RequestHashBatchFromPeers(t *testing.T) { for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { - t.Parallel() - f := createFetch(t) f.cfg.MaxRetriesForRequest = 0 peer := p2p.Peer("buddy") diff --git a/fetch/p2p_test.go b/fetch/p2p_test.go index a2de466a6d..a9dc85a825 100644 --- a/fetch/p2p_test.go +++ b/fetch/p2p_test.go @@ -90,7 +90,6 @@ func createP2PFetch( ) (*testP2PFetch, context.Context) { lg := zaptest.NewLogger(t) ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) - t.Cleanup(cancel) serverHost, err := p2p.AutoStart(ctx, lg, p2pCfg(t), []byte{}, []byte{}) require.NoError(t, err) @@ -100,6 +99,13 @@ func createP2PFetch( require.NoError(t, err) t.Cleanup(func() { assert.NoError(t, clientHost.Stop()) }) + t.Cleanup(func() { + cancel() + time.Sleep(10 * time.Millisecond) + // mafa: p2p internally uses a global logger this should prevent logging after + // the test ends (send PR with fix to libp2p/go-libp2p-pubsub) (go loop in pubsub.go) + }) + var sqlOpts []sql.Opt if sqlCache { sqlOpts = []sql.Opt{sql.WithQueryCache(true)}