Skip to content

Commit

Permalink
Merge pull request #1592 from waku-org/fix/flaky-teardown
Browse files Browse the repository at this point in the history
fix: increase timeout and use tearDownNodes
  • Loading branch information
fbarbu15 authored Oct 10, 2023
2 parents 1b84ae8 + 9ccde73 commit fe64da1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
19 changes: 11 additions & 8 deletions packages/tests/tests/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ import chai, { expect } from "chai";
import chaiAsPromised from "chai-as-promised";
import sinon from "sinon";

import { delay, makeLogFileName, NOISE_KEY_1 } from "../src/index.js";
import {
delay,
makeLogFileName,
NOISE_KEY_1,
tearDownNodes
} from "../src/index.js";
import { NimGoNode } from "../src/node/node.js";

chai.use(chaiAsPromised);
Expand All @@ -43,13 +48,9 @@ describe("Util: toAsyncIterator: Filter", () => {
await waitForRemotePeer(waku, [Protocols.Filter, Protocols.LightPush]);
});

afterEach(async () => {
try {
await nwaku.stop();
await waku.stop();
} catch (err) {
console.log("Failed to stop", err);
}
afterEach(async function () {
this.timeout(10000);
await tearDownNodes(nwaku, waku);
});

it("creates an iterator", async function () {
Expand Down Expand Up @@ -99,6 +100,8 @@ describe("Util: toAsyncIterator: Filter", () => {
payload: utf8ToBytes("This should be received")
});

await delay(400);

await stop();

await waku.lightPush.send(TestEncoder, {
Expand Down
16 changes: 8 additions & 8 deletions packages/tests/tests/waku.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ import { expect } from "chai";

import {
makeLogFileName,
NimGoNode,
NOISE_KEY_1,
NOISE_KEY_2
NOISE_KEY_2,
tearDownNodes
} from "../src/index.js";
import { NimGoNode } from "../src/node/node.js";

const TestContentTopic = "/test/1/waku/utf8";

const TestEncoder = createPlainEncoder({ contentTopic: TestContentTopic });

describe("Waku Dial [node only]", function () {
describe("Interop: NimGoNode", function () {
let waku: Waku;
let waku: LightNode;
let nwaku: NimGoNode;

afterEach(async function () {
!!nwaku &&
nwaku.stop().catch((e) => console.log("Nwaku failed to stop", e));
!!waku && waku.stop().catch((e) => console.log("Waku failed to stop", e));
this.timeout(15000);
await tearDownNodes(nwaku, waku);
});

it("connects to nwaku", async function () {
Expand Down Expand Up @@ -102,8 +102,8 @@ describe("Waku Dial [node only]", function () {
let nwaku: NimGoNode;

afterEach(async function () {
!!nwaku && (await nwaku.stop());
!!waku && waku.stop().catch((e) => console.log("Waku failed to stop", e));
this.timeout(15000);
await tearDownNodes(nwaku, waku);
});

it("Passing an array", async function () {
Expand Down

0 comments on commit fe64da1

Please sign in to comment.