Fix tests of #638

This commit is contained in:
Tanguy 2022-02-21 18:14:43 +01:00
parent fd59cbc7a9
commit f98bf612bd
No known key found for this signature in database
GPG Key ID: 7DD8EC6B6CE6C45E
2 changed files with 4 additions and 2 deletions

View File

@ -574,7 +574,8 @@ suite "GossipSub":
let let
nodes = generateNodes( nodes = generateNodes(
2, 2,
gossip = true) gossip = true,
unsubscribeBackoff = 10.minutes)
# start switches # start switches
nodesFut = await allFinished( nodesFut = await allFinished(

View File

@ -40,6 +40,7 @@ proc generateNodes*(
verifySignature: bool = libp2p_pubsub_verify, verifySignature: bool = libp2p_pubsub_verify,
anonymize: bool = libp2p_pubsub_anonymize, anonymize: bool = libp2p_pubsub_anonymize,
sign: bool = libp2p_pubsub_sign, sign: bool = libp2p_pubsub_sign,
unsubscribeBackoff = 1.seconds,
maxMessageSize: int = 1024 * 1024): seq[PubSub] = maxMessageSize: int = 1024 * 1024): seq[PubSub] =
for i in 0..<num: for i in 0..<num:
@ -53,7 +54,7 @@ proc generateNodes*(
msgIdProvider = msgIdProvider, msgIdProvider = msgIdProvider,
anonymize = anonymize, anonymize = anonymize,
maxMessageSize = maxMessageSize, maxMessageSize = maxMessageSize,
parameters = (var p = GossipSubParams.init(); p.floodPublish = false; p.historyLength = 20; p.historyGossip = 20; p.unsubscribeBackoff = 1.seconds; p)) parameters = (var p = GossipSubParams.init(); p.floodPublish = false; p.historyLength = 20; p.historyGossip = 20; p.unsubscribeBackoff = unsubscribeBackoff; p))
# set some testing params, to enable scores # set some testing params, to enable scores
g.topicParams.mgetOrPut("foobar", TopicParams.init()).topicWeight = 1.0 g.topicParams.mgetOrPut("foobar", TopicParams.init()).topicWeight = 1.0
g.topicParams.mgetOrPut("foo", TopicParams.init()).topicWeight = 1.0 g.topicParams.mgetOrPut("foo", TopicParams.init()).topicWeight = 1.0