diff --git a/PeerManager_test.go b/PeerManager_test.go index 4e599a5..8a1abbd 100644 --- a/PeerManager_test.go +++ b/PeerManager_test.go @@ -39,10 +39,11 @@ func TestNewPeerManager(t *testing.T) { err = pm.AddPeer(peer) require.NoError(t, err) assert.Len(t, pm.GetPeers(), 1) + peer.Shutdown() }) t.Run("1 peer - de dup", func(t *testing.T) { - peers := []string{ + peerAddresses := []string{ "localhost:18333", "localhost:18333", "localhost:18333", @@ -54,12 +55,18 @@ func TestNewPeerManager(t *testing.T) { peerHandler := NewMockPeerHandler() - for _, peerAddress := range peers { + peers := make([]*Peer, len(peerAddresses)) + for i, peerAddress := range peerAddresses { peer, _ := NewPeer(logger, peerAddress, peerHandler, wire.TestNet) _ = pm.AddPeer(peer) + peers[i] = peer } assert.Len(t, pm.GetPeers(), 4) + + for _, peer := range peers { + peer.Shutdown() + } }) } @@ -119,9 +126,3 @@ func TestAnnounceNewTransaction(t *testing.T) { assert.GreaterOrEqual(t, peersMessaged, len(peers)/2) }) } - -func TestPeerManager_addPeer(t *testing.T) { -} - -func TestPeerManager_sendInvBatch(t *testing.T) { -}