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
nodes = generateNodes(
2,
gossip = true)
gossip = true,
unsubscribeBackoff = 10.minutes)
# start switches
nodesFut = await allFinished(

View File

@ -40,6 +40,7 @@ proc generateNodes*(
verifySignature: bool = libp2p_pubsub_verify,
anonymize: bool = libp2p_pubsub_anonymize,
sign: bool = libp2p_pubsub_sign,
unsubscribeBackoff = 1.seconds,
maxMessageSize: int = 1024 * 1024): seq[PubSub] =
for i in 0..<num:
@ -53,7 +54,7 @@ proc generateNodes*(
msgIdProvider = msgIdProvider,
anonymize = anonymize,
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
g.topicParams.mgetOrPut("foobar", TopicParams.init()).topicWeight = 1.0
g.topicParams.mgetOrPut("foo", TopicParams.init()).topicWeight = 1.0