From 7ac87b987001df613fd6513c041822929c3c2d94 Mon Sep 17 00:00:00 2001 From: Keenan Nemetz Date: Wed, 12 Jun 2024 15:51:34 -0700 Subject: [PATCH] fix waitForMerge node address --- net/node.go | 8 ++++---- tests/integration/p2p.go | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/net/node.go b/net/node.go index 70914d472d..a2d27bde6b 100644 --- a/net/node.go +++ b/net/node.go @@ -31,7 +31,7 @@ import ( pubsub "github.com/libp2p/go-libp2p-pubsub" record "github.com/libp2p/go-libp2p-record" libp2pCrypto "github.com/libp2p/go-libp2p/core/crypto" - "github.com/libp2p/go-libp2p/core/event" + libp2pEvent "github.com/libp2p/go-libp2p/core/event" "github.com/libp2p/go-libp2p/core/host" "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/routing" @@ -47,7 +47,7 @@ import ( "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/crypto" - event1 "github.com/sourcenetwork/defradb/event" + "github.com/sourcenetwork/defradb/event" ) var _ client.P2P = (*Node)(nil) @@ -181,14 +181,14 @@ func NewNode( return nil, fin.Cleanup(err) } - sub, err := h.EventBus().Subscribe(&event.EvtPeerConnectednessChanged{}) + sub, err := h.EventBus().Subscribe(&libp2pEvent.EvtPeerConnectednessChanged{}) if err != nil { return nil, fin.Cleanup(err) } // publish subscribed events to the event bus go func() { for val := range sub.Out() { - db.Events().Publish(event1.NewMessage(event1.PeerName, val)) + db.Events().Publish(event.NewMessage(event.PeerName, val)) } }() diff --git a/tests/integration/p2p.go b/tests/integration/p2p.go index cd1dbd3b5c..d990a3d322 100644 --- a/tests/integration/p2p.go +++ b/tests/integration/p2p.go @@ -501,14 +501,11 @@ func waitForMerge( targetToSourceEvents []int, nodeSynced chan struct{}, ) { - sourceNode := s.nodes[sourceNodeID] - targetNode := s.nodes[targetNodeID] - sourceSub := s.eventSubs[sourceNodeID] targetSub := s.eventSubs[targetNodeID] - sourcePeerInfo := sourceNode.PeerInfo() - targetPeerInfo := targetNode.PeerInfo() + sourcePeerInfo := s.nodeAddresses[sourceNodeID] + targetPeerInfo := s.nodeAddresses[targetNodeID] for waitIndex := 0; waitIndex < len(sourceToTargetEvents); waitIndex++ { for i := 0; i < targetToSourceEvents[waitIndex]; i++ {