Fix test problems exposed by MacOS CI runners

This commit is contained in:
Fabiana Cecin 2026-06-11 17:20:50 -03:00
parent 4038769c73
commit 0f6e4796c4
No known key found for this signature in database
GPG Key ID: BCAB8A55CB51B6C7
3 changed files with 31 additions and 3 deletions

View File

@ -118,7 +118,10 @@ suite "RLN Proofs as a Lightpush Service":
manager = waitFor setupOnchainGroupManager(deployContracts = false)
# mount rln-relay
let wakuRlnConfig = getWakuRlnConfig(manager = manager, index = MembershipIndex(1))
# match prod epoch window to reduce test flake
let wakuRlnConfig = getWakuRlnConfig(
manager = manager, index = MembershipIndex(1), epochSizeSec = 600
)
await allFutures(server.start(), client.start())
await server.start()

View File

@ -116,7 +116,10 @@ suite "RLN Proofs as a Lightpush Service":
manager = waitFor setupOnchainGroupManager(deployContracts = false)
# mount rln-relay
let wakuRlnConfig = getWakuRlnConfig(manager = manager, index = MembershipIndex(1))
# match prod epoch window to reduce test flake
let wakuRlnConfig = getWakuRlnConfig(
manager = manager, index = MembershipIndex(1), epochSizeSec = 600
)
await allFutures(server.start(), client.start())
await server.start()

View File

@ -1,7 +1,7 @@
{.used.}
import
std/[options, strformat],
std/[options, strformat, sets, tables],
testutils/unittests,
chronos,
libp2p/protocols/pubsub/[pubsub, gossipsub],
@ -21,6 +21,23 @@ import
./utils,
../resources/payloads
proc hasMeshPeer(relay: WakuRelay, topic: PubsubTopic, peer: PeerId): bool =
for p in relay.mesh.getOrDefault(topic):
if p.peerId == peer:
return true
false
proc waitForMeshPeer(
relay: WakuRelay, topic: PubsubTopic, peer: PeerId, timeout = 10.seconds
): Future[bool] {.async.} =
## Wait until `relay`'s gossipsub mesh for `topic` has GRAFTed `peer`.
let deadline = Moment.now() + timeout
while Moment.now() < deadline:
if relay.hasMeshPeer(topic, peer):
return true
await sleepAsync(50.milliseconds)
false
suite "Waku Relay":
var messageSeq {.threadvar.}: seq[(PubsubTopic, WakuMessage)]
var handlerFuture {.threadvar.}: Future[(PubsubTopic, WakuMessage)]
@ -677,6 +694,11 @@ suite "Waku Relay":
anotherPeerManager.switch.isConnected(otherPeerId)
otherPeerManager.switch.isConnected(anotherPeerId)
# Wait for the mesh to re-form before publishing (else it races the 1s FUTURE_TIMEOUT).
check:
await otherNode.waitForMeshPeer(pubsubTopicC, anotherPeerId)
await anotherNode.waitForMeshPeer(pubsubTopicC, otherPeerId)
# When publishing a message in anotherNode for each of the pubsub topics
handlerFuture = newPushHandlerFuture()
handlerFuture2 = newPushHandlerFuture()