From b166901f60e31b45b3a3bc4a97302dc61b4b45d2 Mon Sep 17 00:00:00 2001 From: Giovanni Petrantoni Date: Wed, 15 Jul 2020 23:03:26 +0900 Subject: [PATCH] gossip internal tests fixes --- tests/pubsub/testgossipinternal.nim | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/pubsub/testgossipinternal.nim b/tests/pubsub/testgossipinternal.nim index be0127873..0b6a5b1ff 100644 --- a/tests/pubsub/testgossipinternal.nim +++ b/tests/pubsub/testgossipinternal.nim @@ -18,6 +18,8 @@ proc noop(data: seq[byte]) {.async, gcsafe.} = discard proc randomPeerInfo(): PeerInfo = PeerInfo.init(PrivateKey.random(ECDSA, rng[]).get()) +let params = GossipSubParams.init() + suite "GossipSub internal": teardown: for tracker in testTrackers(): @@ -26,7 +28,7 @@ suite "GossipSub internal": test "`rebalanceMesh` Degree Lo": proc testRun(): Future[bool] {.async.} = - let gossipSub = newPubSub(TestGossipSub, randomPeerInfo()) + let gossipSub = newPubSub(TestGossipSub, randomPeerInfo(), params = params) let topic = "foobar" gossipSub.mesh[topic] = initHashSet[PubSubPeer]() @@ -56,7 +58,7 @@ suite "GossipSub internal": test "`rebalanceMesh` Degree Hi": proc testRun(): Future[bool] {.async.} = - let gossipSub = newPubSub(TestGossipSub, randomPeerInfo()) + let gossipSub = newPubSub(TestGossipSub, randomPeerInfo(), params = params) let topic = "foobar" gossipSub.mesh[topic] = initHashSet[PubSubPeer]() @@ -87,7 +89,7 @@ suite "GossipSub internal": test "`replenishFanout` Degree Lo": proc testRun(): Future[bool] {.async.} = - let gossipSub = newPubSub(TestGossipSub, randomPeerInfo()) + let gossipSub = newPubSub(TestGossipSub, randomPeerInfo(), params = params) proc handler(peer: PubSubPeer, msg: seq[RPCMsg]) {.async.} = discard @@ -118,7 +120,7 @@ suite "GossipSub internal": test "`dropFanoutPeers` drop expired fanout topics": proc testRun(): Future[bool] {.async.} = - let gossipSub = newPubSub(TestGossipSub, randomPeerInfo()) + let gossipSub = newPubSub(TestGossipSub, randomPeerInfo(), params = params) proc handler(peer: PubSubPeer, msg: seq[RPCMsg]) {.async.} = discard @@ -152,7 +154,7 @@ suite "GossipSub internal": test "`dropFanoutPeers` leave unexpired fanout topics": proc testRun(): Future[bool] {.async.} = - let gossipSub = newPubSub(TestGossipSub, randomPeerInfo()) + let gossipSub = newPubSub(TestGossipSub, randomPeerInfo(), params = params) proc handler(peer: PubSubPeer, msg: seq[RPCMsg]) {.async.} = discard @@ -192,7 +194,7 @@ suite "GossipSub internal": test "`getGossipPeers` - should gather up to degree D non intersecting peers": proc testRun(): Future[bool] {.async.} = - let gossipSub = newPubSub(TestGossipSub, randomPeerInfo()) + let gossipSub = newPubSub(TestGossipSub, randomPeerInfo(), params = params) proc handler(peer: PubSubPeer, msg: seq[RPCMsg]) {.async.} = discard @@ -254,7 +256,7 @@ suite "GossipSub internal": test "`getGossipPeers` - should not crash on missing topics in mesh": proc testRun(): Future[bool] {.async.} = - let gossipSub = newPubSub(TestGossipSub, randomPeerInfo()) + let gossipSub = newPubSub(TestGossipSub, randomPeerInfo(), params = params) proc handler(peer: PubSubPeer, msg: seq[RPCMsg]) {.async.} = discard @@ -296,7 +298,7 @@ suite "GossipSub internal": test "`getGossipPeers` - should not crash on missing topics in fanout": proc testRun(): Future[bool] {.async.} = - let gossipSub = newPubSub(TestGossipSub, randomPeerInfo()) + let gossipSub = newPubSub(TestGossipSub, randomPeerInfo(), params = params) proc handler(peer: PubSubPeer, msg: seq[RPCMsg]) {.async.} = discard @@ -338,7 +340,7 @@ suite "GossipSub internal": test "`getGossipPeers` - should not crash on missing topics in gossip": proc testRun(): Future[bool] {.async.} = - let gossipSub = newPubSub(TestGossipSub, randomPeerInfo()) + let gossipSub = newPubSub(TestGossipSub, randomPeerInfo(), params = params) proc handler(peer: PubSubPeer, msg: seq[RPCMsg]) {.async.} = discard