Skip to content

Commit

Permalink
BAARC-127: Shutdown peer
Browse files Browse the repository at this point in the history
  • Loading branch information
boecklim committed Mar 21, 2024
1 parent 4eeb90b commit 733c20b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions PeerManager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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()
}
})
}

Expand Down Expand Up @@ -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) {
}

0 comments on commit 733c20b

Please sign in to comment.