diff --git a/yarn-project/p2p/src/service/discv5_service.test.ts b/yarn-project/p2p/src/service/discv5_service.test.ts index 9878379ea732..7946bb142592 100644 --- a/yarn-project/p2p/src/service/discv5_service.test.ts +++ b/yarn-project/p2p/src/service/discv5_service.test.ts @@ -6,6 +6,9 @@ import { BootstrapNode } from '../bootstrap/bootstrap.js'; import { DiscV5Service, PeerDiscoveryState } from './discV5_service.js'; import { createLibP2PPeerId } from './libp2p_service.js'; +// The test is flaky, up this constant if the test fails 💀 +const BASE_SLEEP = 500; + describe('Discv5Service', () => { let bootNode: BootstrapNode; let bootNodePeerId: PeerId; @@ -48,7 +51,7 @@ describe('Discv5Service', () => { const node2 = await createNode(port); await node1.start(); await node2.start(); - await sleep(200); + await sleep(BASE_SLEEP); const node1Peers = await Promise.all(node1.getAllPeers().map(async peer => (await peer.peerId()).toString())); const node2Peers = await Promise.all(node2.getAllPeers().map(async peer => (await peer.peerId()).toString())); @@ -68,13 +71,13 @@ describe('Discv5Service', () => { const node2 = await createNode(port); await node1.start(); await node2.start(); - await sleep(200); + await sleep(BASE_SLEEP); await node2.stop(); await bootNode.stop(); await node2.start(); - await sleep(200); + await sleep(BASE_SLEEP); const node2Peers = await Promise.all(node2.getAllPeers().map(async peer => (await peer.peerId()).toString())); expect(node2Peers).toHaveLength(1);