aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/simulations/mocker_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/simulations/mocker_test.go')
-rw-r--r--p2p/simulations/mocker_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/p2p/simulations/mocker_test.go b/p2p/simulations/mocker_test.go
index 192be1732..069040257 100644
--- a/p2p/simulations/mocker_test.go
+++ b/p2p/simulations/mocker_test.go
@@ -90,15 +90,12 @@ func TestMocker(t *testing.T) {
for {
select {
case event := <-events:
- //if the event is a node Up event only
- if event.Node != nil && event.Node.Up {
+ if isNodeUp(event) {
//add the correspondent node ID to the map
nodemap[event.Node.Config.ID] = true
//this means all nodes got a nodeUp event, so we can continue the test
if len(nodemap) == nodeCount {
nodesComplete = true
- //wait for 3s as the mocker will need time to connect the nodes
- //time.Sleep( 3 *time.Second)
}
} else if event.Conn != nil && nodesComplete {
connCount += 1
@@ -169,3 +166,7 @@ func TestMocker(t *testing.T) {
t.Fatalf("Expected empty list of nodes, got: %d", len(nodesInfo))
}
}
+
+func isNodeUp(event *Event) bool {
+ return event.Node != nil && event.Node.Up()
+}