Merge pull request #1402 from waku-org/chores/nwaku-v0.18.0

This commit is contained in:
fryorcraken.eth 2023-07-04 15:59:27 +10:00 committed by GitHub
commit 86c2e9e014
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 30 deletions

View File

@ -57,7 +57,7 @@ jobs:
node: node:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
WAKUNODE_IMAGE: "statusteam/nim-waku:v0.17.0" WAKUNODE_IMAGE: "statusteam/nim-waku:v0.18.0"
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3

View File

@ -14,7 +14,7 @@ export interface Args {
peerExchange?: boolean; peerExchange?: boolean;
discv5Discovery?: boolean; discv5Discovery?: boolean;
storeMessageDbUrl?: string; storeMessageDbUrl?: string;
topics?: string; topic?: string;
rpcPrivate?: boolean; rpcPrivate?: boolean;
websocketSupport?: boolean; websocketSupport?: boolean;
tcpPort?: number; tcpPort?: number;

View File

@ -27,7 +27,7 @@ const WAKU_SERVICE_NODE_PARAMS =
const NODE_READY_LOG_LINE = "Node setup complete"; const NODE_READY_LOG_LINE = "Node setup complete";
const DOCKER_IMAGE_NAME = const DOCKER_IMAGE_NAME =
process.env.WAKUNODE_IMAGE || "statusteam/nim-waku:v0.17.0"; process.env.WAKUNODE_IMAGE || "statusteam/nim-waku:v0.18.0";
const isGoWaku = DOCKER_IMAGE_NAME.includes("go-waku"); const isGoWaku = DOCKER_IMAGE_NAME.includes("go-waku");

View File

@ -4,7 +4,7 @@ import { promisify } from "util";
const execAsync = promisify(exec); const execAsync = promisify(exec);
const WAKUNODE_IMAGE = const WAKUNODE_IMAGE =
process.env.WAKUNODE_IMAGE || "statusteam/nim-waku:v0.17.0"; process.env.WAKUNODE_IMAGE || "statusteam/nim-waku:v0.18.0";
async function main() { async function main() {
try { try {

View File

@ -23,34 +23,36 @@ const TestEncoder = createEncoder({
contentTopic: TestContentTopic, contentTopic: TestContentTopic,
}); });
async function runNodes(
context: Mocha.Context,
pubSubTopic?: string
): Promise<[NimGoNode, LightNode]> {
const nwakuOptional = pubSubTopic ? { topic: pubSubTopic } : {};
const nwaku = new NimGoNode(makeLogFileName(context));
await nwaku.start({
lightpush: true,
relay: true,
...nwakuOptional,
});
const waku = await createLightNode({
pubSubTopic,
staticNoiseKey: NOISE_KEY_1,
});
await waku.start();
await waku.dial(await nwaku.getMultiaddrWithId());
await waitForRemotePeer(waku, [Protocols.LightPush]);
return [nwaku, waku];
}
describe("Waku Light Push [node only]", () => { describe("Waku Light Push [node only]", () => {
let waku: LightNode; let waku: LightNode;
let nwaku: NimGoNode; let nwaku: NimGoNode;
const runNodes = async (
context: Mocha.Context,
pubSubTopic?: string
): Promise<void> => {
const nwakuOptional = pubSubTopic ? { topics: pubSubTopic } : {};
nwaku = new NimGoNode(makeLogFileName(context));
await nwaku.start({
lightpush: true,
relay: true,
...nwakuOptional,
});
waku = await createLightNode({
pubSubTopic,
staticNoiseKey: NOISE_KEY_1,
});
await waku.start();
await waku.dial(await nwaku.getMultiaddrWithId());
await waitForRemotePeer(waku, [Protocols.LightPush]);
};
beforeEach(async function () { beforeEach(async function () {
this.timeout(15_000); this.timeout(15_000);
await runNodes(this); [nwaku, waku] = await runNodes(this);
}); });
afterEach(async function () { afterEach(async function () {
@ -108,12 +110,29 @@ describe("Waku Light Push [node only]", () => {
expect(pushResponse.recipients.length).to.eq(0); expect(pushResponse.recipients.length).to.eq(0);
expect(pushResponse.error).to.eq(SendError.SIZE_TOO_BIG); expect(pushResponse.error).to.eq(SendError.SIZE_TOO_BIG);
}); });
});
it("Push on custom pubsub topic", async function () { describe("Waku Light Push [node only] - custom pubsub topic", () => {
let waku: LightNode;
let nwaku: NimGoNode;
const customPubSubTopic = "/waku/2/custom-dapp/proto";
beforeEach(async function () {
this.timeout(15_000); this.timeout(15_000);
[nwaku, waku] = await runNodes(this, customPubSubTopic);
});
const customPubSubTopic = "/waku/2/custom-dapp/proto"; afterEach(async function () {
await runNodes(this, customPubSubTopic); try {
nwaku?.stop();
waku?.stop();
} catch (e) {
console.error("Failed to stop nodes: ", e);
}
});
it("Push message", async function () {
this.timeout(15_000);
const nimPeerId = await nwaku.getPeerId(); const nimPeerId = await nwaku.getPeerId();
const messageText = "Light Push works!"; const messageText = "Light Push works!";

View File

@ -575,7 +575,7 @@ describe("Waku Store, custom pubsub topic", () => {
nwaku = new NimGoNode(makeLogFileName(this)); nwaku = new NimGoNode(makeLogFileName(this));
await nwaku.start({ await nwaku.start({
store: true, store: true,
topics: customPubSubTopic, topic: customPubSubTopic,
relay: true, relay: true,
}); });
}); });