mirror of https://github.com/waku-org/js-waku.git
improve teardown nodes
This commit is contained in:
parent
1d1c7a28a8
commit
c9389e3d07
|
@ -7,10 +7,13 @@ import { NimGoNode } from "./index.js";
|
||||||
const log = debug("waku:test");
|
const log = debug("waku:test");
|
||||||
|
|
||||||
export async function tearDownNodes(
|
export async function tearDownNodes(
|
||||||
nwakuNodes: NimGoNode[],
|
nwakuNodes: NimGoNode | NimGoNode[],
|
||||||
wakuNodes: LightNode[]
|
wakuNodes: LightNode | LightNode[]
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const stopNwakuNodes = nwakuNodes.map(async (nwaku) => {
|
const nNodes = Array.isArray(nwakuNodes) ? nwakuNodes : [nwakuNodes];
|
||||||
|
const wNodes = Array.isArray(wakuNodes) ? wakuNodes : [wakuNodes];
|
||||||
|
|
||||||
|
const stopNwakuNodes = nNodes.map(async (nwaku) => {
|
||||||
if (nwaku) {
|
if (nwaku) {
|
||||||
await pRetry(
|
await pRetry(
|
||||||
async () => {
|
async () => {
|
||||||
|
@ -26,7 +29,7 @@ export async function tearDownNodes(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const stopWakuNodes = wakuNodes.map(async (waku) => {
|
const stopWakuNodes = wNodes.map(async (waku) => {
|
||||||
if (waku) {
|
if (waku) {
|
||||||
await pRetry(
|
await pRetry(
|
||||||
async () => {
|
async () => {
|
||||||
|
|
|
@ -51,7 +51,7 @@ describe("Waku Filter V2: Multiple PubSubtopics", function () {
|
||||||
|
|
||||||
this.afterEach(async function () {
|
this.afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku, nwaku2], [waku]);
|
await tearDownNodes([nwaku, nwaku2], waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Subscribe and receive messages on custom pubsubtopic", async function () {
|
it("Subscribe and receive messages on custom pubsubtopic", async function () {
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe("Waku Filter V2: Ping", function () {
|
||||||
|
|
||||||
this.afterEach(async function () {
|
this.afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku]);
|
await tearDownNodes(nwaku, waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Ping on subscribed peer", async function () {
|
it("Ping on subscribed peer", async function () {
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe("Waku Filter V2: FilterPush", function () {
|
||||||
|
|
||||||
this.afterEach(async function () {
|
this.afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku]);
|
await tearDownNodes(nwaku, waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
TEST_STRING.forEach((testItem) => {
|
TEST_STRING.forEach((testItem) => {
|
||||||
|
|
|
@ -49,7 +49,7 @@ describe("Waku Filter V2: Subscribe", function () {
|
||||||
|
|
||||||
this.afterEach(async function () {
|
this.afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku, nwaku2], [waku]);
|
await tearDownNodes([nwaku, nwaku2], waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Subscribe and receive messages via lightPush", async function () {
|
it("Subscribe and receive messages via lightPush", async function () {
|
||||||
|
|
|
@ -35,7 +35,7 @@ describe("Waku Filter V2: Unsubscribe", function () {
|
||||||
|
|
||||||
this.afterEach(async function () {
|
this.afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku]);
|
await tearDownNodes(nwaku, waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Unsubscribe 1 topic - node subscribed to 1 topic", async function () {
|
it("Unsubscribe 1 topic - node subscribed to 1 topic", async function () {
|
||||||
|
|
|
@ -36,7 +36,7 @@ describe("Waku Light Push", function () {
|
||||||
|
|
||||||
this.afterEach(async function () {
|
this.afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku]);
|
await tearDownNodes(nwaku, waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
TEST_STRING.forEach((testItem) => {
|
TEST_STRING.forEach((testItem) => {
|
||||||
|
|
|
@ -48,7 +48,7 @@ describe("Waku Light Push : Multiple PubSubtopics", function () {
|
||||||
|
|
||||||
this.afterEach(async function () {
|
this.afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku, nwaku2], [waku]);
|
await tearDownNodes([nwaku, nwaku2], waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Push message on custom pubSubTopic", async function () {
|
it("Push message on custom pubSubTopic", async function () {
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe("Waku Store, cursor", function () {
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku, waku2]);
|
await tearDownNodes(nwaku, [waku, waku2]);
|
||||||
});
|
});
|
||||||
|
|
||||||
[
|
[
|
||||||
|
@ -169,7 +169,7 @@ describe("Waku Store, cursor", function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Passing cursor with wrong pubSubTopic", async function () {
|
it.only("Passing cursor with wrong pubSubTopic", async function () {
|
||||||
await sendMessages(nwaku, totalMsgs, TestContentTopic, DefaultPubSubTopic);
|
await sendMessages(nwaku, totalMsgs, TestContentTopic, DefaultPubSubTopic);
|
||||||
waku = await startAndConnectLightNode(nwaku);
|
waku = await startAndConnectLightNode(nwaku);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ describe("Waku Store, error handling", function () {
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku]);
|
await tearDownNodes(nwaku, waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Query Generator, Wrong PubSubTopic", async function () {
|
it("Query Generator, Wrong PubSubTopic", async function () {
|
||||||
|
|
|
@ -60,7 +60,7 @@ describe("Waku Store, general", function () {
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku, waku2]);
|
await tearDownNodes(nwaku, [waku, waku2]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Query generator for multiple messages", async function () {
|
it("Query generator for multiple messages", async function () {
|
||||||
|
|
|
@ -41,7 +41,7 @@ describe("Waku Store, custom pubsub topic", function () {
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku, nwaku2], [waku]);
|
await tearDownNodes([nwaku, nwaku2], waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Generator, custom pubsub topic", async function () {
|
it("Generator, custom pubsub topic", async function () {
|
||||||
|
|
|
@ -27,7 +27,7 @@ describe("Waku Store, order", function () {
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku]);
|
await tearDownNodes(nwaku, waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
[PageDirection.FORWARD, PageDirection.BACKWARD].forEach((pageDirection) => {
|
[PageDirection.FORWARD, PageDirection.BACKWARD].forEach((pageDirection) => {
|
||||||
|
|
|
@ -25,7 +25,7 @@ describe("Waku Store, page size", function () {
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku]);
|
await tearDownNodes(nwaku, waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
|
@ -25,7 +25,7 @@ describe("Waku Store, sorting", function () {
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku]);
|
await tearDownNodes(nwaku, waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
[PageDirection.FORWARD, PageDirection.BACKWARD].forEach((pageDirection) => {
|
[PageDirection.FORWARD, PageDirection.BACKWARD].forEach((pageDirection) => {
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe("Waku Store, time filter", function () {
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
await tearDownNodes([nwaku], [waku]);
|
await tearDownNodes(nwaku, waku);
|
||||||
});
|
});
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in New Issue