Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tests): several enrtree + static multiaddr for bootstrap #1448

Merged
merged 9 commits into from
Aug 11, 2023
49 changes: 49 additions & 0 deletions packages/tests/tests/waku.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DefaultUserAgent,
waitForRemotePeer,
} from "@waku/core";
import { enrTree, wakuDnsDiscovery } from "@waku/dns-discovery";
import type { LightNode, RelayNode, Waku } from "@waku/interfaces";
import { Protocols } from "@waku/interfaces";
import {
Expand Down Expand Up @@ -116,6 +117,54 @@ describe("Waku Dial [node only]", function () {
expect(connectedPeerID.toString()).to.eq(multiAddrWithId.getPeerId());
});
});

describe("Bootstrap + Multiple ENR Trees", function () {
danisharora099 marked this conversation as resolved.
Show resolved Hide resolved
danisharora099 marked this conversation as resolved.
Show resolved Hide resolved
let waku: LightNode;
let nwaku: NimGoNode;

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

it("", async function () {
this.timeout(10_000);

nwaku = new NimGoNode(makeLogFileName(this));
await nwaku.start();
const multiAddrWithId = await nwaku.getMultiaddrWithId();

const NODE_REQUIREMENTS = {
store: 3,
lightPush: 3,
filter: 3,
};

waku = await createLightNode({
libp2p: {
peerDiscovery: [
bootstrap({ list: [multiAddrWithId.toString()] }),
wakuDnsDiscovery(
[enrTree["PROD"], enrTree["TEST"]],
NODE_REQUIREMENTS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this value optional if not already?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea - addressed here: #1466

),
],
},
});
await waku.start();

const peersDiscovered = await waku.libp2p.peerStore.all();

// 3 from DNS Disc, 1 from bootstrap
expect(peersDiscovered.length).to.eq(3 + 1);
// should also have the bootstrap peer
expect(
peersDiscovered.find(
(p) => p.id.toString() === multiAddrWithId.getPeerId()?.toString()
)
).to.be.true;
});
});
});

describe("Decryption Keys", () => {
Expand Down
Loading