diff --git a/core/peerstatus/status_test.go b/core/peerstatus/status_test.go index a43c7593bb..51090e4be2 100644 --- a/core/peerstatus/status_test.go +++ b/core/peerstatus/status_test.go @@ -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{ { @@ -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) @@ -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{ { @@ -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