Skip to content

Commit

Permalink
Merge pull request #1442 from anyproto/go-3857-fix-p2p-tests
Browse files Browse the repository at this point in the history
GO-3857: fix events sending
  • Loading branch information
AnastasiaShemyakinskaya authored Aug 5, 2024
2 parents f9a420b + eb6848f commit 163eb6a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions core/peerstatus/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,6 @@ func TestP2pStatus_SendPeerUpdate(t *testing.T) {
f.setNotPossibleStatus()
checkStatus(t, "spaceId", f.p2pStatus, NotPossible)

f.store.UpdateLocalPeer("peerId", []string{"spaceId"})
ctrl := gomock.NewController(t)
peer := mock_peer.NewMockPeer(ctrl)
peer.EXPECT().Id().Return("peerId")
f.sender.EXPECT().Broadcast(&pb.Event{
Messages: []*pb.EventMessage{
{
Expand All @@ -220,6 +216,10 @@ func TestP2pStatus_SendPeerUpdate(t *testing.T) {
},
},
})
f.store.UpdateLocalPeer("peerId", []string{"spaceId"})
ctrl := gomock.NewController(t)
peer := mock_peer.NewMockPeer(ctrl)
peer.EXPECT().Id().Return("peerId")
err := f.pool.AddPeer(context.Background(), peer)
assert.Nil(t, err)

Expand All @@ -234,13 +234,6 @@ func TestP2pStatus_SendPeerUpdate(t *testing.T) {
// when
checkStatus(t, "spaceId", f.p2pStatus, NotConnected)

f.store.UpdateLocalPeer("peerId", []string{"spaceId"})
ctrl := gomock.NewController(t)
peer := mock_peer.NewMockPeer(ctrl)
peer.EXPECT().Id().Return("peerId")
err := f.pool.AddPeer(context.Background(), peer)
assert.Nil(t, err)

f.sender.EXPECT().Broadcast(&pb.Event{
Messages: []*pb.EventMessage{
{
Expand All @@ -254,6 +247,13 @@ func TestP2pStatus_SendPeerUpdate(t *testing.T) {
},
},
})
f.store.UpdateLocalPeer("peerId", []string{"spaceId"})
ctrl := gomock.NewController(t)
peer := mock_peer.NewMockPeer(ctrl)
peer.EXPECT().Id().Return("peerId")
err := f.pool.AddPeer(context.Background(), peer)
assert.Nil(t, err)

checkStatus(t, "spaceId", f.p2pStatus, Connected)

// then
Expand Down

0 comments on commit 163eb6a

Please sign in to comment.