From 937a18468ae4259f97244f2df8667c5790ccdb41 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Tue, 26 Jan 2021 17:49:37 +0100 Subject: [PATCH] test/p2p: close transports to avoid goroutine leak failures (#5982) --- p2p/router_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/p2p/router_test.go b/p2p/router_test.go index 49b6bbb21..5436ee02b 100644 --- a/p2p/router_test.go +++ b/p2p/router_test.go @@ -36,16 +36,17 @@ func TestRouter(t *testing.T) { logger := log.TestingLogger() network := p2p.NewMemoryNetwork(logger) transport := network.GenerateTransport() + defer transport.Close() chID := p2p.ChannelID(1) // Start some other in-memory network nodes to communicate with, running // a simple echo reactor that returns received messages. peers := []p2p.PeerAddress{} for i := 0; i < 3; i++ { - i := i peerManager, err := p2p.NewPeerManager(dbm.NewMemDB(), p2p.PeerManagerOptions{}) require.NoError(t, err) peerTransport := network.GenerateTransport() + defer peerTransport.Close() peerRouter := p2p.NewRouter( logger.With("peerID", i), peerManager,