fix in last test

This commit is contained in:
shashankshampi 2024-10-24 16:54:19 +05:30
parent a3c29ae7a1
commit aa34c7f553

View File

@ -229,18 +229,12 @@ suite "GossipSub Topic Membership Tests":
currentGossip.fanout.len == 0 currentGossip.fanout.len == 0
let firstNodeGossip = GossipSub(nodes[0]) let firstNodeGossip = GossipSub(nodes[0])
let peersToUnsubscribe = firstNodeGossip.mesh[topic].toSeq()[0 .. 2] let peersToUnsubscribe = nodes[1 ..< 3]
let peerIdsToUnsubscribe = peersToUnsubscribe.mapIt(it.peerId) for peer in peersToUnsubscribe:
for node in nodes: peer.unsubscribe(topic, voidTopicHandler)
for peerId in peerIdsToUnsubscribe:
node.unsubscribe(topic, voidTopicHandler)
node.peers.del(peerId)
await sleepAsync(3 * DURATION_TIMEOUT) await sleepAsync(3 * DURATION_TIMEOUT)
check firstNodeGossip.mesh.getOrDefault(topic).len == 3 check firstNodeGossip.mesh.getOrDefault(topic).len == 3
for peer in peersToUnsubscribe:
check not firstNodeGossip.mesh[topic].contains(peer)
await allFuturesThrowing(nodes.mapIt(allFutures(it.switch.stop()))) await allFuturesThrowing(nodes.mapIt(allFutures(it.switch.stop())))