Skip to content

Commit

Permalink
fix: bump the wait on discv5 test
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Apr 24, 2024
1 parent af43744 commit dbe765a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions yarn-project/p2p/src/service/discv5_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));

Expand All @@ -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);
Expand Down

0 comments on commit dbe765a

Please sign in to comment.