Skip to content

Commit ca7733f

Browse files
committed
Fix 'test gossipsub fanout expiry' go-gossipsub test
1 parent 70c3528 commit ca7733f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/go-gossipsub.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ describe('go-libp2p-pubsub gossipsub tests', function () {
338338

339339
expect(psubs[0]['fanout'].size).to.be.gt(0)
340340

341-
// wait for TTL to expore fanout peers in owner
342-
await delay(2000)
341+
// wait for heartbeats to expire fanout peers
342+
await Promise.all(psubs.map((ps) => awaitEvents(ps, 'gossipsub:heartbeat', 2)))
343343

344-
expect(psubs[0]['fanout'].size).to.be.eql(0)
344+
expect(psubs[0]['fanout'].size, 'should have no fanout peers after not publishing for a while').to.be.eql(0)
345345
await tearDownGossipsubs(psubs)
346346
})
347347
it('test gossipsub gossip', async function () {

0 commit comments

Comments
 (0)