From 5df41b0adf2104e61ad4dec3a3b24c3fc8330380 Mon Sep 17 00:00:00 2001 From: Arseniy Klempner Date: Thu, 9 May 2024 01:25:35 -0700 Subject: [PATCH] fix: add shard arg to nwaku in peer management tests (#2005) --- packages/tests/src/run-tests.js | 6 +++++- packages/tests/src/types.ts | 1 + .../tests/sharding/peer_management.spec.ts | 18 ++++++++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/tests/src/run-tests.js b/packages/tests/src/run-tests.js index bed0e50bae..41cb98cd33 100644 --- a/packages/tests/src/run-tests.js +++ b/packages/tests/src/run-tests.js @@ -26,7 +26,11 @@ async function main() { // Run mocha tests const mocha = spawn("npx", mochaArgs, { - stdio: "inherit" + stdio: "inherit", + env: { + ...process.env, + NODE_ENV: "test" + } }); mocha.on("error", (error) => { diff --git a/packages/tests/src/types.ts b/packages/tests/src/types.ts index 33bb757475..8efde21e46 100644 --- a/packages/tests/src/types.ts +++ b/packages/tests/src/types.ts @@ -25,6 +25,7 @@ export interface Args { // `legacyFilter` is required to enable filter v1 with go-waku legacyFilter?: boolean; clusterId?: number; + shard?: Array; } export interface Ports { diff --git a/packages/tests/tests/sharding/peer_management.spec.ts b/packages/tests/tests/sharding/peer_management.spec.ts index 557087f184..64bd342dde 100644 --- a/packages/tests/tests/sharding/peer_management.spec.ts +++ b/packages/tests/tests/sharding/peer_management.spec.ts @@ -61,7 +61,8 @@ describe("Static Sharding: Peer Management", function () { discv5Discovery: true, peerExchange: true, relay: true, - clusterId: clusterId + clusterId: clusterId, + shard: [2] }); const enr1 = (await nwaku1.info()).enrUri; @@ -72,7 +73,8 @@ describe("Static Sharding: Peer Management", function () { peerExchange: true, discv5BootstrapNode: enr1, relay: true, - clusterId: clusterId + clusterId: clusterId, + shard: [2] }); const enr2 = (await nwaku2.info()).enrUri; @@ -83,7 +85,8 @@ describe("Static Sharding: Peer Management", function () { peerExchange: true, discv5BootstrapNode: enr2, relay: true, - clusterId: clusterId + clusterId: clusterId, + shard: [2] }); const nwaku3Ma = await nwaku3.getMultiaddrWithId(); @@ -140,7 +143,8 @@ describe("Static Sharding: Peer Management", function () { relay: true, discv5Discovery: true, peerExchange: true, - clusterId: clusterId + clusterId: clusterId, + shard: [1] }); const enr1 = (await nwaku1.info()).enrUri; @@ -151,7 +155,8 @@ describe("Static Sharding: Peer Management", function () { discv5Discovery: true, peerExchange: true, discv5BootstrapNode: enr1, - clusterId: clusterId + clusterId: clusterId, + shard: [2] }); const enr2 = (await nwaku2.info()).enrUri; @@ -162,7 +167,8 @@ describe("Static Sharding: Peer Management", function () { discv5Discovery: true, peerExchange: true, discv5BootstrapNode: enr2, - clusterId: clusterId + clusterId: clusterId, + shard: [2] }); const nwaku3Ma = await nwaku3.getMultiaddrWithId();