Browse Source

test/p2p: close transports to avoid goroutine leak failures (#5982)

pull/5989/head
Erik Grinaker 4 years ago
committed by GitHub
parent
commit
937a18468a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      p2p/router_test.go

+ 2
- 1
p2p/router_test.go View File

@ -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,


Loading…
Cancel
Save