Skip to content

Commit fe64da1

Browse files
authored
Merge pull request #1592 from waku-org/fix/flaky-teardown
fix: increase timeout and use tearDownNodes
2 parents 1b84ae8 + 9ccde73 commit fe64da1

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

packages/tests/tests/utils.spec.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ import chai, { expect } from "chai";
1717
import chaiAsPromised from "chai-as-promised";
1818
import sinon from "sinon";
1919

20-
import { delay, makeLogFileName, NOISE_KEY_1 } from "../src/index.js";
20+
import {
21+
delay,
22+
makeLogFileName,
23+
NOISE_KEY_1,
24+
tearDownNodes
25+
} from "../src/index.js";
2126
import { NimGoNode } from "../src/node/node.js";
2227

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

46-
afterEach(async () => {
47-
try {
48-
await nwaku.stop();
49-
await waku.stop();
50-
} catch (err) {
51-
console.log("Failed to stop", err);
52-
}
51+
afterEach(async function () {
52+
this.timeout(10000);
53+
await tearDownNodes(nwaku, waku);
5354
});
5455

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

103+
await delay(400);
104+
102105
await stop();
103106

104107
await waku.lightPush.send(TestEncoder, {

packages/tests/tests/waku.node.spec.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ import { expect } from "chai";
2222

2323
import {
2424
makeLogFileName,
25-
NimGoNode,
2625
NOISE_KEY_1,
27-
NOISE_KEY_2
26+
NOISE_KEY_2,
27+
tearDownNodes
2828
} from "../src/index.js";
29+
import { NimGoNode } from "../src/node/node.js";
2930

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

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

3435
describe("Waku Dial [node only]", function () {
3536
describe("Interop: NimGoNode", function () {
36-
let waku: Waku;
37+
let waku: LightNode;
3738
let nwaku: NimGoNode;
3839

3940
afterEach(async function () {
40-
!!nwaku &&
41-
nwaku.stop().catch((e) => console.log("Nwaku failed to stop", e));
42-
!!waku && waku.stop().catch((e) => console.log("Waku failed to stop", e));
41+
this.timeout(15000);
42+
await tearDownNodes(nwaku, waku);
4343
});
4444

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

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

109109
it("Passing an array", async function () {

0 commit comments

Comments
 (0)