mirror of https://github.com/waku-org/js-waku.git
chore(tests): restructure & cleanup (#1796)
* chore: restructure folder heirrarchy * fix: imports
This commit is contained in:
parent
7a8ef875dd
commit
2e6d9836bf
|
@ -5,12 +5,6 @@
|
||||||
* @module
|
* @module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from "./async_fs.js";
|
export * from "./utils/index.js";
|
||||||
export * from "./constants.js";
|
export * from "./constants.js";
|
||||||
export * from "./delay.js";
|
export * from "./lib/index.js";
|
||||||
export * from "./log_file.js";
|
|
||||||
export * from "./node/node.js";
|
|
||||||
export * from "./teardown.js";
|
|
||||||
export * from "./message_collector.js";
|
|
||||||
export * from "./utils.js";
|
|
||||||
export * from "./waitForRemotePeerWithCodec.js";
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import fs from "fs";
|
||||||
import { Logger } from "@waku/utils";
|
import { Logger } from "@waku/utils";
|
||||||
import Docker from "dockerode";
|
import Docker from "dockerode";
|
||||||
|
|
||||||
import { Args } from "./interfaces.js";
|
import { Args } from "../types.js";
|
||||||
|
|
||||||
const log = new Logger("test:docker");
|
const log = new Logger("test:docker");
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
export * from "./message_collector.js";
|
||||||
|
export * from "./service_node.js";
|
|
@ -5,9 +5,8 @@ import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
|
||||||
import { AssertionError, expect } from "chai";
|
import { AssertionError, expect } from "chai";
|
||||||
import { equals } from "uint8arrays/equals";
|
import { equals } from "uint8arrays/equals";
|
||||||
|
|
||||||
import { MessageRpcResponse } from "./node/interfaces.js";
|
import { base64ToUtf8, delay, ServiceNode } from "../index.js";
|
||||||
|
import { MessageRpcResponse } from "../types.js";
|
||||||
import { base64ToUtf8, delay, NimGoNode } from "./index.js";
|
|
||||||
|
|
||||||
const log = new Logger("test:message-collector");
|
const log = new Logger("test:message-collector");
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ export class MessageCollector {
|
||||||
list: Array<MessageRpcResponse | DecodedMessage> = [];
|
list: Array<MessageRpcResponse | DecodedMessage> = [];
|
||||||
callback: (msg: DecodedMessage) => void = () => {};
|
callback: (msg: DecodedMessage) => void = () => {};
|
||||||
|
|
||||||
constructor(private nwaku?: NimGoNode) {
|
constructor(private nwaku?: ServiceNode) {
|
||||||
if (!this.nwaku) {
|
if (!this.nwaku) {
|
||||||
this.callback = (msg: DecodedMessage): void => {
|
this.callback = (msg: DecodedMessage): void => {
|
||||||
log.info("Got a message");
|
log.info("Got a message");
|
|
@ -8,18 +8,18 @@ import { bytesToHex, hexToBytes } from "@waku/utils/bytes";
|
||||||
import pRetry from "p-retry";
|
import pRetry from "p-retry";
|
||||||
import portfinder from "portfinder";
|
import portfinder from "portfinder";
|
||||||
|
|
||||||
import { existsAsync, mkdirAsync, openAsync } from "../async_fs.js";
|
|
||||||
import { delay } from "../delay.js";
|
|
||||||
import waitForLine from "../log_file.js";
|
|
||||||
|
|
||||||
import Dockerode from "./dockerode.js";
|
|
||||||
import {
|
import {
|
||||||
Args,
|
Args,
|
||||||
KeyPair,
|
KeyPair,
|
||||||
LogLevel,
|
LogLevel,
|
||||||
MessageRpcQuery,
|
MessageRpcQuery,
|
||||||
MessageRpcResponse
|
MessageRpcResponse
|
||||||
} from "./interfaces.js";
|
} from "../types.js";
|
||||||
|
import { existsAsync, mkdirAsync, openAsync } from "../utils/async_fs.js";
|
||||||
|
import { delay } from "../utils/delay.js";
|
||||||
|
import waitForLine from "../utils/log_file.js";
|
||||||
|
|
||||||
|
import Dockerode from "./dockerode.js";
|
||||||
|
|
||||||
const log = new Logger("test:node");
|
const log = new Logger("test:node");
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ BigInt.prototype.toJSON = function toJSON() {
|
||||||
return Number(this);
|
return Number(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
export class NimGoNode {
|
export class ServiceNode {
|
||||||
private docker?: Dockerode;
|
private docker?: Dockerode;
|
||||||
private peerId?: PeerId;
|
private peerId?: PeerId;
|
||||||
private multiaddrWithId?: Multiaddr;
|
private multiaddrWithId?: Multiaddr;
|
||||||
|
@ -464,7 +464,3 @@ interface RpcInfoResponse {
|
||||||
listenAddresses: string[];
|
listenAddresses: string[];
|
||||||
enrUri?: string;
|
enrUri?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function base64ToUtf8(b64: string): string {
|
|
||||||
return Buffer.from(b64, "base64").toString("utf-8");
|
|
||||||
}
|
|
|
@ -28,3 +28,5 @@ export async function waitForFile(path: string): Promise<void> {
|
||||||
}
|
}
|
||||||
} while (!found);
|
} while (!found);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export * from "./log_file.js";
|
|
@ -0,0 +1,3 @@
|
||||||
|
export function base64ToUtf8(b64: string): string {
|
||||||
|
return Buffer.from(b64, "base64").toString("utf-8");
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
export function delay(ms: number): Promise<void> {
|
export function delay(ms: number): Promise<void> {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export * from "./async_fs.js";
|
|
@ -0,0 +1,6 @@
|
||||||
|
export * from "./generate_test_data.js";
|
||||||
|
export * from "./teardown.js";
|
||||||
|
export * from "./random_array.js";
|
||||||
|
export * from "./wait_for_remote_peer_with_codec.js";
|
||||||
|
export * from "./delay.js";
|
||||||
|
export * from "./base64_utf8.js";
|
|
@ -2,12 +2,12 @@ import { Waku } from "@waku/interfaces";
|
||||||
import { Logger } from "@waku/utils";
|
import { Logger } from "@waku/utils";
|
||||||
import pRetry from "p-retry";
|
import pRetry from "p-retry";
|
||||||
|
|
||||||
import { NimGoNode } from "./index.js";
|
import { ServiceNode } from "../lib/service_node.js";
|
||||||
|
|
||||||
const log = new Logger("test:teardown");
|
const log = new Logger("test:teardown");
|
||||||
|
|
||||||
export async function tearDownNodes(
|
export async function tearDownNodes(
|
||||||
nwakuNodes: NimGoNode | NimGoNode[],
|
nwakuNodes: ServiceNode | ServiceNode[],
|
||||||
wakuNodes: Waku | Waku[]
|
wakuNodes: Waku | Waku[]
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const nNodes = Array.isArray(nwakuNodes) ? nwakuNodes : [nwakuNodes];
|
const nNodes = Array.isArray(nwakuNodes) ? nwakuNodes : [nwakuNodes];
|
|
@ -14,8 +14,8 @@ import { createLightNode } from "@waku/sdk";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import sinon, { SinonSpy, SinonStub } from "sinon";
|
import sinon, { SinonSpy, SinonStub } from "sinon";
|
||||||
|
|
||||||
import { delay } from "../dist/delay.js";
|
import { delay } from "../src/index.js";
|
||||||
import { makeLogFileName, NimGoNode, tearDownNodes } from "../src/index.js";
|
import { makeLogFileName, ServiceNode, tearDownNodes } from "../src/index.js";
|
||||||
|
|
||||||
const TEST_TIMEOUT = 10_000;
|
const TEST_TIMEOUT = 10_000;
|
||||||
const DELAY_MS = 1_000;
|
const DELAY_MS = 1_000;
|
||||||
|
@ -486,15 +486,15 @@ describe("ConnectionManager", function () {
|
||||||
|
|
||||||
describe("Connection state", () => {
|
describe("Connection state", () => {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
let nwaku1: NimGoNode;
|
let nwaku1: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let nwaku1PeerId: Multiaddr;
|
let nwaku1PeerId: Multiaddr;
|
||||||
let nwaku2PeerId: Multiaddr;
|
let nwaku2PeerId: Multiaddr;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku1 = new NimGoNode(makeLogFileName(this.ctx) + "1");
|
nwaku1 = new ServiceNode(makeLogFileName(this.ctx) + "1");
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this.ctx) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this.ctx) + "2");
|
||||||
await nwaku1.start({
|
await nwaku1.start({
|
||||||
filter: true
|
filter: true
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { createLightNode } from "@waku/sdk";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
import { MemoryDatastore } from "datastore-core/memory";
|
import { MemoryDatastore } from "datastore-core/memory";
|
||||||
|
|
||||||
import { delay } from "../src/delay.js";
|
import { delay } from "../src/index.js";
|
||||||
|
|
||||||
const maxQuantity = 3;
|
const maxQuantity = 3;
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,16 @@ import { Protocols } from "@waku/interfaces";
|
||||||
import { createRelayNode } from "@waku/sdk/relay";
|
import { createRelayNode } from "@waku/sdk/relay";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { makeLogFileName, NOISE_KEY_1, tearDownNodes } from "../src/index.js";
|
import {
|
||||||
import { NimGoNode } from "../src/node/node.js";
|
makeLogFileName,
|
||||||
|
NOISE_KEY_1,
|
||||||
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../src/index.js";
|
||||||
|
|
||||||
describe("ENR Interop: NimGoNode", function () {
|
describe("ENR Interop: ServiceNode", function () {
|
||||||
let waku: RelayNode;
|
let waku: RelayNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
|
@ -19,7 +23,7 @@ describe("ENR Interop: NimGoNode", function () {
|
||||||
|
|
||||||
it("Relay", async function () {
|
it("Relay", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
relay: true,
|
relay: true,
|
||||||
store: false,
|
store: false,
|
||||||
|
@ -51,7 +55,7 @@ describe("ENR Interop: NimGoNode", function () {
|
||||||
|
|
||||||
it("Relay + Store", async function () {
|
it("Relay + Store", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
relay: true,
|
relay: true,
|
||||||
store: true,
|
store: true,
|
||||||
|
@ -83,7 +87,7 @@ describe("ENR Interop: NimGoNode", function () {
|
||||||
|
|
||||||
it("All", async function () {
|
it("All", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
relay: true,
|
relay: true,
|
||||||
store: true,
|
store: true,
|
||||||
|
|
|
@ -29,9 +29,9 @@ import {
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
NOISE_KEY_1,
|
NOISE_KEY_1,
|
||||||
NOISE_KEY_2,
|
NOISE_KEY_2,
|
||||||
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../src/index.js";
|
} from "../src/index.js";
|
||||||
import { NimGoNode } from "../src/node/node.js";
|
|
||||||
|
|
||||||
const log = new Logger("test:ephemeral");
|
const log = new Logger("test:ephemeral");
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ const TestDecoder = createDecoder(TestContentTopic);
|
||||||
|
|
||||||
describe("Waku Message Ephemeral field", () => {
|
describe("Waku Message Ephemeral field", () => {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
let subscription: IFilterSubscription;
|
let subscription: IFilterSubscription;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ describe("Waku Message Ephemeral field", () => {
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15_000);
|
this.timeout(15_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { expect } from "chai";
|
||||||
import {
|
import {
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
MessageCollector,
|
MessageCollector,
|
||||||
NimGoNode,
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../../src/index.js";
|
} from "../../src/index.js";
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ describe("Waku Filter V2: Multiple PubsubTopics", function () {
|
||||||
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let subscription: IFilterSubscription;
|
let subscription: IFilterSubscription;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ describe("Waku Filter V2: Multiple PubsubTopics", function () {
|
||||||
await subscription.subscribe([customDecoder1], messageCollector.callback);
|
await subscription.subscribe([customDecoder1], messageCollector.callback);
|
||||||
|
|
||||||
// Set up and start a new nwaku node with customPubsubTopic1
|
// Set up and start a new nwaku node with customPubsubTopic1
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
@ -185,8 +185,8 @@ describe("Waku Filter V2 (Autosharding): Multiple PubsubTopics", function () {
|
||||||
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let subscription: IFilterSubscription;
|
let subscription: IFilterSubscription;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ describe("Waku Filter V2 (Autosharding): Multiple PubsubTopics", function () {
|
||||||
await subscription.subscribe([customDecoder1], messageCollector.callback);
|
await subscription.subscribe([customDecoder1], messageCollector.callback);
|
||||||
|
|
||||||
// Set up and start a new nwaku node with customPubsubTopic1
|
// Set up and start a new nwaku node with customPubsubTopic1
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
@ -359,8 +359,8 @@ describe("Waku Filter V2 (Named sharding): Multiple PubsubTopics", function () {
|
||||||
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let subscription: IFilterSubscription;
|
let subscription: IFilterSubscription;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ describe("Waku Filter V2 (Named sharding): Multiple PubsubTopics", function () {
|
||||||
await subscription.subscribe([customDecoder1], messageCollector.callback);
|
await subscription.subscribe([customDecoder1], messageCollector.callback);
|
||||||
|
|
||||||
// Set up and start a new nwaku node with customPubsubTopic1
|
// Set up and start a new nwaku node with customPubsubTopic1
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
|
|
@ -3,7 +3,11 @@ import type { IFilterSubscription, LightNode } from "@waku/interfaces";
|
||||||
import { utf8ToBytes } from "@waku/utils/bytes";
|
import { utf8ToBytes } from "@waku/utils/bytes";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { MessageCollector, NimGoNode, tearDownNodes } from "../../src/index.js";
|
import {
|
||||||
|
MessageCollector,
|
||||||
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../../src/index.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
runNodes,
|
runNodes,
|
||||||
|
@ -17,7 +21,7 @@ describe("Waku Filter V2: Ping", function () {
|
||||||
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let subscription: IFilterSubscription;
|
let subscription: IFilterSubscription;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { expect } from "chai";
|
||||||
import {
|
import {
|
||||||
delay,
|
delay,
|
||||||
MessageCollector,
|
MessageCollector,
|
||||||
NimGoNode,
|
ServiceNode,
|
||||||
tearDownNodes,
|
tearDownNodes,
|
||||||
TEST_STRING,
|
TEST_STRING,
|
||||||
TEST_TIMESTAMPS
|
TEST_TIMESTAMPS
|
||||||
|
@ -26,7 +26,7 @@ describe("Waku Filter V2: FilterPush", function () {
|
||||||
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let subscription: IFilterSubscription;
|
let subscription: IFilterSubscription;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {
|
||||||
generateTestData,
|
generateTestData,
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
MessageCollector,
|
MessageCollector,
|
||||||
NimGoNode,
|
ServiceNode,
|
||||||
tearDownNodes,
|
tearDownNodes,
|
||||||
TEST_STRING
|
TEST_STRING
|
||||||
} from "../../src/index.js";
|
} from "../../src/index.js";
|
||||||
|
@ -35,8 +35,8 @@ describe("Waku Filter V2: Subscribe", function () {
|
||||||
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let subscription: IFilterSubscription;
|
let subscription: IFilterSubscription;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ describe("Waku Filter V2: Subscribe", function () {
|
||||||
|
|
||||||
// Send a test message using the relay post method.
|
// Send a test message using the relay post method.
|
||||||
await nwaku.sendMessage(
|
await nwaku.sendMessage(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
contentTopic: TestContentTopic,
|
contentTopic: TestContentTopic,
|
||||||
payload: utf8ToBytes(messageText)
|
payload: utf8ToBytes(messageText)
|
||||||
})
|
})
|
||||||
|
@ -370,7 +370,7 @@ describe("Waku Filter V2: Subscribe", function () {
|
||||||
await subscription.subscribe([TestDecoder], messageCollector.callback);
|
await subscription.subscribe([TestDecoder], messageCollector.callback);
|
||||||
|
|
||||||
// Set up and start a new nwaku node
|
// Set up and start a new nwaku node
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { expect } from "chai";
|
||||||
import {
|
import {
|
||||||
generateTestData,
|
generateTestData,
|
||||||
MessageCollector,
|
MessageCollector,
|
||||||
NimGoNode,
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../../src/index.js";
|
} from "../../src/index.js";
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ describe("Waku Filter V2: Unsubscribe", function () {
|
||||||
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let subscription: IFilterSubscription;
|
let subscription: IFilterSubscription;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { Logger } from "@waku/utils";
|
||||||
import { utf8ToBytes } from "@waku/utils/bytes";
|
import { utf8ToBytes } from "@waku/utils/bytes";
|
||||||
import { Context } from "mocha";
|
import { Context } from "mocha";
|
||||||
|
|
||||||
import { makeLogFileName, NimGoNode, NOISE_KEY_1 } from "../../src/index.js";
|
import { makeLogFileName, NOISE_KEY_1, ServiceNode } from "../../src/index.js";
|
||||||
|
|
||||||
// Constants for test configuration.
|
// Constants for test configuration.
|
||||||
export const log = new Logger("test:filter");
|
export const log = new Logger("test:filter");
|
||||||
|
@ -47,8 +47,8 @@ export async function runNodes(
|
||||||
//TODO: change this to use `ShardInfo` instead of `string[]`
|
//TODO: change this to use `ShardInfo` instead of `string[]`
|
||||||
pubsubTopics: string[],
|
pubsubTopics: string[],
|
||||||
shardInfo?: ShardingParams
|
shardInfo?: ShardingParams
|
||||||
): Promise<[NimGoNode, LightNode]> {
|
): Promise<[ServiceNode, LightNode]> {
|
||||||
const nwaku = new NimGoNode(makeLogFileName(context));
|
const nwaku = new ServiceNode(makeLogFileName(context));
|
||||||
|
|
||||||
await nwaku.start(
|
await nwaku.start(
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,12 +9,12 @@ import { utf8ToBytes } from "@waku/utils/bytes";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
generateRandomUint8Array,
|
||||||
MessageCollector,
|
MessageCollector,
|
||||||
NimGoNode,
|
ServiceNode,
|
||||||
tearDownNodes,
|
tearDownNodes,
|
||||||
TEST_STRING
|
TEST_STRING
|
||||||
} from "../../src/index.js";
|
} from "../../src/index.js";
|
||||||
import { generateRandomUint8Array } from "../../src/random_array.js";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
messagePayload,
|
messagePayload,
|
||||||
|
@ -28,7 +28,7 @@ describe("Waku Light Push", function () {
|
||||||
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
// Set the timeout for all tests in this suite. Can be overwritten at test level
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
this.beforeEach(async function () {
|
this.beforeEach(async function () {
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { expect } from "chai";
|
||||||
import {
|
import {
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
MessageCollector,
|
MessageCollector,
|
||||||
NimGoNode,
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../../src/index.js";
|
} from "../../src/index.js";
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ import { messageText, runNodes } from "./utils.js";
|
||||||
describe("Waku Light Push : Multiple PubsubTopics", function () {
|
describe("Waku Light Push : Multiple PubsubTopics", function () {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
const customPubsubTopic1 = singleShardInfoToPubsubTopic({
|
const customPubsubTopic1 = singleShardInfoToPubsubTopic({
|
||||||
clusterId: 3,
|
clusterId: 3,
|
||||||
|
@ -126,7 +126,7 @@ describe("Waku Light Push : Multiple PubsubTopics", function () {
|
||||||
|
|
||||||
it("Light push messages to 2 nwaku nodes each with different pubsubtopics", async function () {
|
it("Light push messages to 2 nwaku nodes each with different pubsubtopics", async function () {
|
||||||
// Set up and start a new nwaku node with Default PubsubTopic
|
// Set up and start a new nwaku node with Default PubsubTopic
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
@ -177,8 +177,8 @@ describe("Waku Light Push : Multiple PubsubTopics", function () {
|
||||||
describe("Waku Light Push (Autosharding): Multiple PubsubTopics", function () {
|
describe("Waku Light Push (Autosharding): Multiple PubsubTopics", function () {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
// When using lightpush, we have to use a cluster id of 1 because that is the default cluster id for autosharding
|
// When using lightpush, we have to use a cluster id of 1 because that is the default cluster id for autosharding
|
||||||
|
@ -282,7 +282,7 @@ describe("Waku Light Push (Autosharding): Multiple PubsubTopics", function () {
|
||||||
|
|
||||||
it("Light push messages to 2 nwaku nodes each with different pubsubtopics", async function () {
|
it("Light push messages to 2 nwaku nodes each with different pubsubtopics", async function () {
|
||||||
// Set up and start a new nwaku node with Default PubsubTopic
|
// Set up and start a new nwaku node with Default PubsubTopic
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
@ -333,8 +333,8 @@ describe("Waku Light Push (Autosharding): Multiple PubsubTopics", function () {
|
||||||
describe("Waku Light Push (named sharding): Multiple PubsubTopics", function () {
|
describe("Waku Light Push (named sharding): Multiple PubsubTopics", function () {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let messageCollector: MessageCollector;
|
let messageCollector: MessageCollector;
|
||||||
|
|
||||||
// When using lightpush, we have to use a cluster id of 1 because that is the default cluster id for autosharding
|
// When using lightpush, we have to use a cluster id of 1 because that is the default cluster id for autosharding
|
||||||
|
@ -439,7 +439,7 @@ describe("Waku Light Push (named sharding): Multiple PubsubTopics", function ()
|
||||||
|
|
||||||
it("Light push messages to 2 nwaku nodes each with different pubsubtopics", async function () {
|
it("Light push messages to 2 nwaku nodes each with different pubsubtopics", async function () {
|
||||||
// Set up and start a new nwaku node with Default PubsubTopic
|
// Set up and start a new nwaku node with Default PubsubTopic
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
import { createLightNode, utf8ToBytes } from "@waku/sdk";
|
import { createLightNode, utf8ToBytes } from "@waku/sdk";
|
||||||
import { Logger } from "@waku/utils";
|
import { Logger } from "@waku/utils";
|
||||||
|
|
||||||
import { makeLogFileName, NimGoNode, NOISE_KEY_1 } from "../../src/index.js";
|
import { makeLogFileName, NOISE_KEY_1, ServiceNode } from "../../src/index.js";
|
||||||
|
|
||||||
// Constants for test configuration.
|
// Constants for test configuration.
|
||||||
export const log = new Logger("test:lightpush");
|
export const log = new Logger("test:lightpush");
|
||||||
|
@ -21,8 +21,8 @@ export async function runNodes(
|
||||||
context: Mocha.Context,
|
context: Mocha.Context,
|
||||||
pubsubTopics: string[],
|
pubsubTopics: string[],
|
||||||
shardInfo?: ShardingParams
|
shardInfo?: ShardingParams
|
||||||
): Promise<[NimGoNode, LightNode]> {
|
): Promise<[ServiceNode, LightNode]> {
|
||||||
const nwaku = new NimGoNode(makeLogFileName(context));
|
const nwaku = new ServiceNode(makeLogFileName(context));
|
||||||
await nwaku.start(
|
await nwaku.start(
|
||||||
{ lightpush: true, relay: true, pubsubTopic: pubsubTopics },
|
{ lightpush: true, relay: true, pubsubTopic: pubsubTopics },
|
||||||
{ retries: 3 }
|
{ retries: 3 }
|
||||||
|
|
|
@ -6,18 +6,21 @@ import { shardInfoToPubsubTopics } from "@waku/utils";
|
||||||
import chai, { expect } from "chai";
|
import chai, { expect } from "chai";
|
||||||
import chaiAsPromised from "chai-as-promised";
|
import chaiAsPromised from "chai-as-promised";
|
||||||
|
|
||||||
import { delay, tearDownNodes } from "../src/index.js";
|
import {
|
||||||
import { makeLogFileName } from "../src/log_file.js";
|
delay,
|
||||||
import { NimGoNode } from "../src/node/node.js";
|
makeLogFileName,
|
||||||
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../src/index.js";
|
||||||
|
|
||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
|
|
||||||
describe("Metadata Protocol", () => {
|
describe("Metadata Protocol", () => {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku1: NimGoNode;
|
let nwaku1: ServiceNode;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
nwaku1 = new NimGoNode(makeLogFileName(this) + "1");
|
nwaku1 = new ServiceNode(makeLogFileName(this) + "1");
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
|
|
@ -11,13 +11,13 @@ import Sinon, { SinonSpy, SinonStub } from "sinon";
|
||||||
import {
|
import {
|
||||||
delay,
|
delay,
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
NimGoNode,
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../src/index.js";
|
} from "../src/index.js";
|
||||||
|
|
||||||
describe("multiaddr: dialing", function () {
|
describe("multiaddr: dialing", function () {
|
||||||
let waku: Waku;
|
let waku: Waku;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let dialPeerSpy: SinonSpy;
|
let dialPeerSpy: SinonSpy;
|
||||||
let isPeerTopicConfigured: SinonStub;
|
let isPeerTopicConfigured: SinonStub;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ describe("multiaddr: dialing", function () {
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(10_000);
|
this.timeout(10_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start();
|
await nwaku.start();
|
||||||
|
|
||||||
waku = await createLightNode();
|
waku = await createLightNode();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { defaultArgs } from "../src/index.js";
|
import { defaultArgs } from "../src/index.js";
|
||||||
import { argsToArray } from "../src/node/dockerode.js";
|
import { argsToArray } from "../src/lib/dockerode.js";
|
||||||
|
|
||||||
describe("nwaku", () => {
|
describe("nwaku", () => {
|
||||||
it("Correctly serialized arguments", function () {
|
it("Correctly serialized arguments", function () {
|
||||||
|
|
|
@ -10,20 +10,23 @@ import {
|
||||||
import { createLightNode, Libp2pComponents } from "@waku/sdk";
|
import { createLightNode, Libp2pComponents } from "@waku/sdk";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { delay } from "../src/delay.js";
|
import {
|
||||||
import { tearDownNodes, waitForRemotePeerWithCodec } from "../src/index.js";
|
delay,
|
||||||
import { makeLogFileName } from "../src/log_file.js";
|
makeLogFileName,
|
||||||
import { NimGoNode } from "../src/node/node.js";
|
ServiceNode,
|
||||||
|
tearDownNodes,
|
||||||
|
waitForRemotePeerWithCodec
|
||||||
|
} from "../src/index.js";
|
||||||
|
|
||||||
describe("Peer Exchange", () => {
|
describe("Peer Exchange", () => {
|
||||||
describe("Locally Run Nodes", () => {
|
describe("Locally Run Nodes", () => {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku1: NimGoNode;
|
let nwaku1: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
nwaku1 = new NimGoNode(makeLogFileName(this) + "1");
|
nwaku1 = new ServiceNode(makeLogFileName(this) + "1");
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
@ -111,12 +114,12 @@ describe("Peer Exchange", () => {
|
||||||
this.timeout(55_000);
|
this.timeout(55_000);
|
||||||
|
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku1: NimGoNode;
|
let nwaku1: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
nwaku1 = new NimGoNode(makeLogFileName(this) + "1");
|
nwaku1 = new ServiceNode(makeLogFileName(this) + "1");
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
});
|
});
|
||||||
|
|
||||||
tests({
|
tests({
|
||||||
|
|
|
@ -6,21 +6,22 @@ import { bytesToUtf8, utf8ToBytes } from "@waku/utils/bytes";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
base64ToUtf8,
|
||||||
delay,
|
delay,
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
NOISE_KEY_1,
|
NOISE_KEY_1,
|
||||||
NOISE_KEY_2,
|
NOISE_KEY_2,
|
||||||
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../../src/index.js";
|
} from "../../src/index.js";
|
||||||
import { MessageRpcResponse } from "../../src/node/interfaces.js";
|
import { MessageRpcResponse } from "../../src/types.js";
|
||||||
import { base64ToUtf8, NimGoNode } from "../../src/node/node.js";
|
|
||||||
|
|
||||||
import { TestContentTopic, TestDecoder, TestEncoder } from "./utils.js";
|
import { TestContentTopic, TestDecoder, TestEncoder } from "./utils.js";
|
||||||
|
|
||||||
describe("Waku Relay, Interop", function () {
|
describe("Waku Relay, Interop", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: RelayNode;
|
let waku: RelayNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
|
@ -29,7 +30,7 @@ describe("Waku Relay, Interop", function () {
|
||||||
});
|
});
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
|
||||||
nwaku = new NimGoNode(this.test?.ctx?.currentTest?.title + "");
|
nwaku = new ServiceNode(this.test?.ctx?.currentTest?.title + "");
|
||||||
await nwaku.start({ relay: true });
|
await nwaku.start({ relay: true });
|
||||||
|
|
||||||
await waku.dial(await nwaku.getMultiaddrWithId());
|
await waku.dial(await nwaku.getMultiaddrWithId());
|
||||||
|
@ -89,7 +90,7 @@ describe("Waku Relay, Interop", function () {
|
||||||
);
|
);
|
||||||
|
|
||||||
await nwaku.sendMessage(
|
await nwaku.sendMessage(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
contentTopic: TestContentTopic,
|
contentTopic: TestContentTopic,
|
||||||
payload: utf8ToBytes(messageText)
|
payload: utf8ToBytes(messageText)
|
||||||
})
|
})
|
||||||
|
@ -105,7 +106,7 @@ describe("Waku Relay, Interop", function () {
|
||||||
describe("Two nodes connected to nwaku", function () {
|
describe("Two nodes connected to nwaku", function () {
|
||||||
let waku1: RelayNode;
|
let waku1: RelayNode;
|
||||||
let waku2: RelayNode;
|
let waku2: RelayNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
await tearDownNodes(nwaku, [waku1, waku2]);
|
await tearDownNodes(nwaku, [waku1, waku2]);
|
||||||
|
@ -122,7 +123,7 @@ describe("Waku Relay, Interop", function () {
|
||||||
}).then((waku) => waku.start().then(() => waku))
|
}).then((waku) => waku.start().then(() => waku))
|
||||||
]);
|
]);
|
||||||
|
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ relay: true });
|
await nwaku.start({ relay: true });
|
||||||
|
|
||||||
const nwakuMultiaddr = await nwaku.getMultiaddrWithId();
|
const nwakuMultiaddr = await nwaku.getMultiaddrWithId();
|
||||||
|
|
|
@ -6,13 +6,13 @@ import { expect } from "chai";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
delay,
|
delay,
|
||||||
|
generateRandomUint8Array,
|
||||||
MessageCollector,
|
MessageCollector,
|
||||||
NOISE_KEY_1,
|
NOISE_KEY_1,
|
||||||
NOISE_KEY_2,
|
NOISE_KEY_2,
|
||||||
tearDownNodes,
|
tearDownNodes,
|
||||||
TEST_STRING
|
TEST_STRING
|
||||||
} from "../../src/index.js";
|
} from "../../src/index.js";
|
||||||
import { generateRandomUint8Array } from "../../src/random_array.js";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
log,
|
log,
|
||||||
|
|
|
@ -46,7 +46,7 @@ describe("Waku Relay, Subscribe", function () {
|
||||||
});
|
});
|
||||||
await waku1.dial(waku2.libp2p.peerId);
|
await waku1.dial(waku2.libp2p.peerId);
|
||||||
log.info("before each hook done");
|
log.info("before each hook done");
|
||||||
messageCollector = new MessageCollector();
|
messageCollector = new MessageCollector(this.nwaku);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
|
|
@ -16,27 +16,29 @@ import chai, { expect } from "chai";
|
||||||
import chaiAsPromised from "chai-as-promised";
|
import chaiAsPromised from "chai-as-promised";
|
||||||
import Sinon, { SinonSpy } from "sinon";
|
import Sinon, { SinonSpy } from "sinon";
|
||||||
|
|
||||||
import { delay } from "../../src/delay.js";
|
import {
|
||||||
import { makeLogFileName } from "../../src/log_file.js";
|
delay,
|
||||||
import { NimGoNode } from "../../src/node/node.js";
|
makeLogFileName,
|
||||||
import { tearDownNodes } from "../../src/teardown.js";
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../../src/index.js";
|
||||||
|
|
||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
|
|
||||||
describe("Static Sharding: Peer Management", function () {
|
describe("Static Sharding: Peer Management", function () {
|
||||||
describe("Peer Exchange", function () {
|
describe("Peer Exchange", function () {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku1: NimGoNode;
|
let nwaku1: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let nwaku3: NimGoNode;
|
let nwaku3: ServiceNode;
|
||||||
|
|
||||||
let dialPeerSpy: SinonSpy;
|
let dialPeerSpy: SinonSpy;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku1 = new NimGoNode(makeLogFileName(this) + "1");
|
nwaku1 = new ServiceNode(makeLogFileName(this) + "1");
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
nwaku3 = new NimGoNode(makeLogFileName(this) + "3");
|
nwaku3 = new ServiceNode(makeLogFileName(this) + "3");
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
@ -199,17 +201,17 @@ describe("Autosharding: Peer Management", function () {
|
||||||
|
|
||||||
describe("Peer Exchange", function () {
|
describe("Peer Exchange", function () {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku1: NimGoNode;
|
let nwaku1: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
let nwaku3: NimGoNode;
|
let nwaku3: ServiceNode;
|
||||||
|
|
||||||
let dialPeerSpy: SinonSpy;
|
let dialPeerSpy: SinonSpy;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku1 = new NimGoNode(makeLogFileName(this) + "1_auto");
|
nwaku1 = new ServiceNode(makeLogFileName(this) + "1_auto");
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2_auto");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2_auto");
|
||||||
nwaku3 = new NimGoNode(makeLogFileName(this) + "3_auto");
|
nwaku3 = new ServiceNode(makeLogFileName(this) + "3_auto");
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
|
|
|
@ -13,9 +13,11 @@ import {
|
||||||
import { singleShardInfoToPubsubTopic } from "@waku/utils";
|
import { singleShardInfoToPubsubTopic } from "@waku/utils";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { tearDownNodes } from "../../src/index.js";
|
import {
|
||||||
import { makeLogFileName } from "../../src/log_file.js";
|
makeLogFileName,
|
||||||
import { NimGoNode } from "../../src/node/node.js";
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../../src/index.js";
|
||||||
|
|
||||||
const PubsubTopic1 = singleShardInfoToPubsubTopic({
|
const PubsubTopic1 = singleShardInfoToPubsubTopic({
|
||||||
clusterId: 0,
|
clusterId: 0,
|
||||||
|
@ -34,11 +36,11 @@ const ContentTopic2 = "/myapp/1/latest/proto";
|
||||||
|
|
||||||
describe("Static Sharding: Running Nodes", () => {
|
describe("Static Sharding: Running Nodes", () => {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15_000);
|
this.timeout(15_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ store: true, lightpush: true, relay: true });
|
await nwaku.start({ store: true, lightpush: true, relay: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -109,11 +111,11 @@ describe("Static Sharding: Running Nodes", () => {
|
||||||
|
|
||||||
describe("Autosharding: Running Nodes", () => {
|
describe("Autosharding: Running Nodes", () => {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15_000);
|
this.timeout(15_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ store: true, lightpush: true, relay: true });
|
await nwaku.start({ store: true, lightpush: true, relay: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,11 @@ import { DefaultPubsubTopic } from "@waku/interfaces";
|
||||||
import { bytesToUtf8 } from "@waku/utils/bytes";
|
import { bytesToUtf8 } from "@waku/utils/bytes";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { makeLogFileName, NimGoNode, tearDownNodes } from "../../src/index.js";
|
import {
|
||||||
|
makeLogFileName,
|
||||||
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../../src/index.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
customShardedPubsubTopic1,
|
customShardedPubsubTopic1,
|
||||||
|
@ -19,11 +23,11 @@ describe("Waku Store, cursor", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let waku2: LightNode;
|
let waku2: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ store: true, lightpush: true, relay: true });
|
await nwaku.start({ store: true, lightpush: true, relay: true });
|
||||||
await nwaku.ensureSubscriptions();
|
await nwaku.ensureSubscriptions();
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,11 @@ import { DefaultPubsubTopic } from "@waku/interfaces";
|
||||||
import { IMessage, type LightNode } from "@waku/interfaces";
|
import { IMessage, type LightNode } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { makeLogFileName, NimGoNode, tearDownNodes } from "../../src/index.js";
|
import {
|
||||||
|
makeLogFileName,
|
||||||
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../../src/index.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
customDecoder1,
|
customDecoder1,
|
||||||
|
@ -15,11 +19,11 @@ import {
|
||||||
describe("Waku Store, error handling", function () {
|
describe("Waku Store, error handling", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ store: true, lightpush: true, relay: true });
|
await nwaku.start({ store: true, lightpush: true, relay: true });
|
||||||
await nwaku.ensureSubscriptions();
|
await nwaku.ensureSubscriptions();
|
||||||
waku = await startAndConnectLightNode(nwaku);
|
waku = await startAndConnectLightNode(nwaku);
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {
|
||||||
delay,
|
delay,
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
MessageCollector,
|
MessageCollector,
|
||||||
NimGoNode,
|
ServiceNode,
|
||||||
tearDownNodes,
|
tearDownNodes,
|
||||||
TEST_STRING
|
TEST_STRING
|
||||||
} from "../../src/index.js";
|
} from "../../src/index.js";
|
||||||
|
@ -46,11 +46,11 @@ describe("Waku Store, general", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let waku2: LightNode;
|
let waku2: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ store: true, lightpush: true, relay: true });
|
await nwaku.start({ store: true, lightpush: true, relay: true });
|
||||||
await nwaku.ensureSubscriptions();
|
await nwaku.ensureSubscriptions();
|
||||||
});
|
});
|
||||||
|
@ -82,7 +82,7 @@ describe("Waku Store, general", function () {
|
||||||
for (const testItem of TEST_STRING) {
|
for (const testItem of TEST_STRING) {
|
||||||
expect(
|
expect(
|
||||||
await nwaku.sendMessage(
|
await nwaku.sendMessage(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
payload: utf8ToBytes(testItem["value"]),
|
payload: utf8ToBytes(testItem["value"]),
|
||||||
contentTopic: TestContentTopic
|
contentTopic: TestContentTopic
|
||||||
}),
|
}),
|
||||||
|
@ -93,7 +93,7 @@ describe("Waku Store, general", function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
waku = await startAndConnectLightNode(nwaku);
|
waku = await startAndConnectLightNode(nwaku);
|
||||||
const messageCollector = new MessageCollector();
|
const messageCollector = new MessageCollector(nwaku);
|
||||||
messageCollector.list = await processQueriedMessages(
|
messageCollector.list = await processQueriedMessages(
|
||||||
waku,
|
waku,
|
||||||
[TestDecoder],
|
[TestDecoder],
|
||||||
|
@ -110,14 +110,14 @@ describe("Waku Store, general", function () {
|
||||||
|
|
||||||
it("Query generator for multiple messages with multiple decoders", async function () {
|
it("Query generator for multiple messages with multiple decoders", async function () {
|
||||||
await nwaku.sendMessage(
|
await nwaku.sendMessage(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
payload: utf8ToBytes("M1"),
|
payload: utf8ToBytes("M1"),
|
||||||
contentTopic: TestContentTopic
|
contentTopic: TestContentTopic
|
||||||
}),
|
}),
|
||||||
DefaultPubsubTopic
|
DefaultPubsubTopic
|
||||||
);
|
);
|
||||||
await nwaku.sendMessage(
|
await nwaku.sendMessage(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
payload: utf8ToBytes("M2"),
|
payload: utf8ToBytes("M2"),
|
||||||
contentTopic: customContentTopic1
|
contentTopic: customContentTopic1
|
||||||
}),
|
}),
|
||||||
|
@ -125,7 +125,7 @@ describe("Waku Store, general", function () {
|
||||||
);
|
);
|
||||||
waku = await startAndConnectLightNode(nwaku);
|
waku = await startAndConnectLightNode(nwaku);
|
||||||
|
|
||||||
const messageCollector = new MessageCollector();
|
const messageCollector = new MessageCollector(nwaku);
|
||||||
messageCollector.list = await processQueriedMessages(
|
messageCollector.list = await processQueriedMessages(
|
||||||
waku,
|
waku,
|
||||||
[TestDecoder, secondDecoder],
|
[TestDecoder, secondDecoder],
|
||||||
|
@ -139,7 +139,7 @@ describe("Waku Store, general", function () {
|
||||||
for (const testItem of TEST_STRING) {
|
for (const testItem of TEST_STRING) {
|
||||||
expect(
|
expect(
|
||||||
await nwaku.sendMessage(
|
await nwaku.sendMessage(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
payload: utf8ToBytes(messageText),
|
payload: utf8ToBytes(messageText),
|
||||||
contentTopic: testItem["value"]
|
contentTopic: testItem["value"]
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -6,8 +6,8 @@ import { expect } from "chai";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
NimGoNode,
|
|
||||||
NOISE_KEY_1,
|
NOISE_KEY_1,
|
||||||
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../../src/index.js";
|
} from "../../src/index.js";
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ import {
|
||||||
describe("Waku Store, custom pubsub topic", function () {
|
describe("Waku Store, custom pubsub topic", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
store: true,
|
store: true,
|
||||||
pubsubTopic: [customShardedPubsubTopic1, customShardedPubsubTopic2],
|
pubsubTopic: [customShardedPubsubTopic1, customShardedPubsubTopic2],
|
||||||
|
@ -119,7 +119,7 @@ describe("Waku Store, custom pubsub topic", function () {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
|
|
||||||
// Set up and start a new nwaku node with Default Pubsubtopic
|
// Set up and start a new nwaku node with Default Pubsubtopic
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
store: true,
|
store: true,
|
||||||
pubsubTopic: [customShardedPubsubTopic2],
|
pubsubTopic: [customShardedPubsubTopic2],
|
||||||
|
@ -175,8 +175,8 @@ describe("Waku Store, custom pubsub topic", function () {
|
||||||
describe("Waku Store (Autosharding), custom pubsub topic", function () {
|
describe("Waku Store (Autosharding), custom pubsub topic", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
|
|
||||||
const customContentTopic1 = "/waku/2/content/utf8";
|
const customContentTopic1 = "/waku/2/content/utf8";
|
||||||
const customContentTopic2 = "/myapp/1/latest/proto";
|
const customContentTopic2 = "/myapp/1/latest/proto";
|
||||||
|
@ -206,7 +206,7 @@ describe("Waku Store (Autosharding), custom pubsub topic", function () {
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
store: true,
|
store: true,
|
||||||
pubsubTopic: [autoshardingPubsubTopic1, autoshardingPubsubTopic2],
|
pubsubTopic: [autoshardingPubsubTopic1, autoshardingPubsubTopic2],
|
||||||
|
@ -279,7 +279,7 @@ describe("Waku Store (Autosharding), custom pubsub topic", function () {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
|
|
||||||
// Set up and start a new nwaku node with Default Pubsubtopic
|
// Set up and start a new nwaku node with Default Pubsubtopic
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
store: true,
|
store: true,
|
||||||
pubsubTopic: [autoshardingPubsubTopic2],
|
pubsubTopic: [autoshardingPubsubTopic2],
|
||||||
|
@ -325,8 +325,8 @@ describe("Waku Store (Autosharding), custom pubsub topic", function () {
|
||||||
describe("Waku Store (named sharding), custom pubsub topic", function () {
|
describe("Waku Store (named sharding), custom pubsub topic", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
let nwaku2: NimGoNode;
|
let nwaku2: ServiceNode;
|
||||||
|
|
||||||
const customDecoder1 = createDecoder(
|
const customDecoder1 = createDecoder(
|
||||||
customContentTopic1,
|
customContentTopic1,
|
||||||
|
@ -339,7 +339,7 @@ describe("Waku Store (named sharding), custom pubsub topic", function () {
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
store: true,
|
store: true,
|
||||||
pubsubTopic: [customShardedPubsubTopic1, customShardedPubsubTopic2],
|
pubsubTopic: [customShardedPubsubTopic1, customShardedPubsubTopic2],
|
||||||
|
@ -429,7 +429,7 @@ describe("Waku Store (named sharding), custom pubsub topic", function () {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
|
|
||||||
// Set up and start a new nwaku node with Default Pubsubtopic
|
// Set up and start a new nwaku node with Default Pubsubtopic
|
||||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
nwaku2 = new ServiceNode(makeLogFileName(this) + "2");
|
||||||
await nwaku2.start({
|
await nwaku2.start({
|
||||||
store: true,
|
store: true,
|
||||||
pubsubTopic: [customShardedPubsubTopic2],
|
pubsubTopic: [customShardedPubsubTopic2],
|
||||||
|
|
|
@ -3,7 +3,11 @@ import type { IMessage, LightNode } from "@waku/interfaces";
|
||||||
import { DefaultPubsubTopic } from "@waku/interfaces";
|
import { DefaultPubsubTopic } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { makeLogFileName, NimGoNode, tearDownNodes } from "../../src/index.js";
|
import {
|
||||||
|
makeLogFileName,
|
||||||
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../../src/index.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
chunkAndReverseArray,
|
chunkAndReverseArray,
|
||||||
|
@ -17,11 +21,11 @@ import {
|
||||||
describe("Waku Store, order", function () {
|
describe("Waku Store, order", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ store: true, lightpush: true, relay: true });
|
await nwaku.start({ store: true, lightpush: true, relay: true });
|
||||||
await nwaku.ensureSubscriptions();
|
await nwaku.ensureSubscriptions();
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,11 @@ import { DefaultPubsubTopic } from "@waku/interfaces";
|
||||||
import type { LightNode } from "@waku/interfaces";
|
import type { LightNode } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { makeLogFileName, NimGoNode, tearDownNodes } from "../../src/index.js";
|
import {
|
||||||
|
makeLogFileName,
|
||||||
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../../src/index.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sendMessages,
|
sendMessages,
|
||||||
|
@ -14,11 +18,11 @@ import {
|
||||||
describe("Waku Store, page size", function () {
|
describe("Waku Store, page size", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ store: true, lightpush: true, relay: true });
|
await nwaku.start({ store: true, lightpush: true, relay: true });
|
||||||
await nwaku.ensureSubscriptions();
|
await nwaku.ensureSubscriptions();
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,11 @@ import { DecodedMessage, PageDirection } from "@waku/core";
|
||||||
import type { IMessage, LightNode } from "@waku/interfaces";
|
import type { IMessage, LightNode } from "@waku/interfaces";
|
||||||
import { DefaultPubsubTopic } from "@waku/interfaces";
|
import { DefaultPubsubTopic } from "@waku/interfaces";
|
||||||
|
|
||||||
import { makeLogFileName, NimGoNode, tearDownNodes } from "../../src/index.js";
|
import {
|
||||||
|
makeLogFileName,
|
||||||
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../../src/index.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sendMessages,
|
sendMessages,
|
||||||
|
@ -15,11 +19,11 @@ import {
|
||||||
describe("Waku Store, sorting", function () {
|
describe("Waku Store, sorting", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ store: true, lightpush: true, relay: true });
|
await nwaku.start({ store: true, lightpush: true, relay: true });
|
||||||
await nwaku.ensureSubscriptions();
|
await nwaku.ensureSubscriptions();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
import type { IMessage, LightNode } from "@waku/interfaces";
|
import type { IMessage, LightNode } from "@waku/interfaces";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { makeLogFileName, NimGoNode, tearDownNodes } from "../../src/index.js";
|
import {
|
||||||
|
makeLogFileName,
|
||||||
|
ServiceNode,
|
||||||
|
tearDownNodes
|
||||||
|
} from "../../src/index.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
adjustDate,
|
adjustDate,
|
||||||
|
@ -13,11 +17,11 @@ import {
|
||||||
describe("Waku Store, time filter", function () {
|
describe("Waku Store, time filter", function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({ store: true, lightpush: true, relay: true });
|
await nwaku.start({ store: true, lightpush: true, relay: true });
|
||||||
await nwaku.ensureSubscriptions();
|
await nwaku.ensureSubscriptions();
|
||||||
});
|
});
|
||||||
|
@ -42,7 +46,7 @@ describe("Waku Store, time filter", function () {
|
||||||
const msgTimestamp = adjustDate(new Date(), msgTime);
|
const msgTimestamp = adjustDate(new Date(), msgTime);
|
||||||
expect(
|
expect(
|
||||||
await nwaku.sendMessage(
|
await nwaku.sendMessage(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
payload: new Uint8Array([0]),
|
payload: new Uint8Array([0]),
|
||||||
contentTopic: TestContentTopic,
|
contentTopic: TestContentTopic,
|
||||||
timestamp: msgTimestamp
|
timestamp: msgTimestamp
|
||||||
|
@ -87,7 +91,7 @@ describe("Waku Store, time filter", function () {
|
||||||
const msgTimestamp = adjustDate(new Date(), msgTime);
|
const msgTimestamp = adjustDate(new Date(), msgTime);
|
||||||
expect(
|
expect(
|
||||||
await nwaku.sendMessage(
|
await nwaku.sendMessage(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
payload: new Uint8Array([0]),
|
payload: new Uint8Array([0]),
|
||||||
contentTopic: TestContentTopic,
|
contentTopic: TestContentTopic,
|
||||||
timestamp: msgTimestamp
|
timestamp: msgTimestamp
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { createLightNode } from "@waku/sdk";
|
||||||
import { Logger, singleShardInfoToPubsubTopic } from "@waku/utils";
|
import { Logger, singleShardInfoToPubsubTopic } from "@waku/utils";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { delay, NimGoNode, NOISE_KEY_1 } from "../../src";
|
import { delay, NOISE_KEY_1, ServiceNode } from "../../src";
|
||||||
|
|
||||||
export const log = new Logger("test:store");
|
export const log = new Logger("test:store");
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ export const totalMsgs = 20;
|
||||||
export const messageText = "Store Push works!";
|
export const messageText = "Store Push works!";
|
||||||
|
|
||||||
export async function sendMessages(
|
export async function sendMessages(
|
||||||
instance: NimGoNode,
|
instance: ServiceNode,
|
||||||
numMessages: number,
|
numMessages: number,
|
||||||
contentTopic: string,
|
contentTopic: string,
|
||||||
pubsubTopic: string
|
pubsubTopic: string
|
||||||
|
@ -55,7 +55,7 @@ export async function sendMessages(
|
||||||
for (let i = 0; i < numMessages; i++) {
|
for (let i = 0; i < numMessages; i++) {
|
||||||
expect(
|
expect(
|
||||||
await instance.sendMessage(
|
await instance.sendMessage(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
payload: new Uint8Array([i]),
|
payload: new Uint8Array([i]),
|
||||||
contentTopic: contentTopic
|
contentTopic: contentTopic
|
||||||
}),
|
}),
|
||||||
|
@ -67,14 +67,14 @@ export async function sendMessages(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function sendMessagesAutosharding(
|
export async function sendMessagesAutosharding(
|
||||||
instance: NimGoNode,
|
instance: ServiceNode,
|
||||||
numMessages: number,
|
numMessages: number,
|
||||||
contentTopic: string
|
contentTopic: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
for (let i = 0; i < numMessages; i++) {
|
for (let i = 0; i < numMessages; i++) {
|
||||||
expect(
|
expect(
|
||||||
await instance.sendMessageAutosharding(
|
await instance.sendMessageAutosharding(
|
||||||
NimGoNode.toMessageRpcQuery({
|
ServiceNode.toMessageRpcQuery({
|
||||||
payload: new Uint8Array([i]),
|
payload: new Uint8Array([i]),
|
||||||
contentTopic: contentTopic
|
contentTopic: contentTopic
|
||||||
})
|
})
|
||||||
|
@ -102,7 +102,7 @@ export async function processQueriedMessages(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function startAndConnectLightNode(
|
export async function startAndConnectLightNode(
|
||||||
instance: NimGoNode,
|
instance: ServiceNode,
|
||||||
pubsubTopics: string[] = [DefaultPubsubTopic],
|
pubsubTopics: string[] = [DefaultPubsubTopic],
|
||||||
shardInfo?: ShardingParams
|
shardInfo?: ShardingParams
|
||||||
): Promise<LightNode> {
|
): Promise<LightNode> {
|
||||||
|
|
|
@ -14,9 +14,9 @@ import {
|
||||||
delay,
|
delay,
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
NOISE_KEY_1,
|
NOISE_KEY_1,
|
||||||
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../src/index.js";
|
} from "../src/index.js";
|
||||||
import { NimGoNode } from "../src/node/node.js";
|
|
||||||
|
|
||||||
chai.use(chaiAsPromised);
|
chai.use(chaiAsPromised);
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@ const TestDecoder = createDecoder(TestContentTopic);
|
||||||
|
|
||||||
describe("Util: toAsyncIterator: Filter", () => {
|
describe("Util: toAsyncIterator: Filter", () => {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
|
|
@ -9,14 +9,14 @@ import {
|
||||||
delay,
|
delay,
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
NOISE_KEY_1,
|
NOISE_KEY_1,
|
||||||
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../src/index.js";
|
} from "../src/index.js";
|
||||||
import { NimGoNode } from "../src/node/node.js";
|
|
||||||
|
|
||||||
describe("Wait for remote peer", function () {
|
describe("Wait for remote peer", function () {
|
||||||
let waku1: RelayNode;
|
let waku1: RelayNode;
|
||||||
let waku2: LightNode;
|
let waku2: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
|
@ -25,7 +25,7 @@ describe("Wait for remote peer", function () {
|
||||||
|
|
||||||
it("Relay - dialed first", async function () {
|
it("Relay - dialed first", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
relay: true,
|
relay: true,
|
||||||
store: false,
|
store: false,
|
||||||
|
@ -50,7 +50,7 @@ describe("Wait for remote peer", function () {
|
||||||
|
|
||||||
it("Relay - dialed after", async function () {
|
it("Relay - dialed after", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
relay: true,
|
relay: true,
|
||||||
store: false,
|
store: false,
|
||||||
|
@ -98,7 +98,7 @@ describe("Wait for remote peer", function () {
|
||||||
|
|
||||||
it("Store - dialed first", async function () {
|
it("Store - dialed first", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
store: true,
|
store: true,
|
||||||
relay: false,
|
relay: false,
|
||||||
|
@ -124,7 +124,7 @@ describe("Wait for remote peer", function () {
|
||||||
|
|
||||||
it("Store - dialed after - with timeout", async function () {
|
it("Store - dialed after - with timeout", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
store: true,
|
store: true,
|
||||||
relay: false,
|
relay: false,
|
||||||
|
@ -152,7 +152,7 @@ describe("Wait for remote peer", function () {
|
||||||
|
|
||||||
it("LightPush", async function () {
|
it("LightPush", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
filter: false,
|
filter: false,
|
||||||
|
@ -180,7 +180,7 @@ describe("Wait for remote peer", function () {
|
||||||
|
|
||||||
it("Filter", async function () {
|
it("Filter", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: false,
|
lightpush: false,
|
||||||
|
@ -208,7 +208,7 @@ describe("Wait for remote peer", function () {
|
||||||
|
|
||||||
it("Light Node - default protocols", async function () {
|
it("Light Node - default protocols", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
lightpush: true,
|
lightpush: true,
|
||||||
|
@ -248,7 +248,7 @@ describe("Wait for remote peer", function () {
|
||||||
|
|
||||||
it("Privacy Node - default protocol", async function () {
|
it("Privacy Node - default protocol", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
filter: false,
|
filter: false,
|
||||||
lightpush: false,
|
lightpush: false,
|
||||||
|
|
|
@ -4,11 +4,11 @@ import { LightNode } from "@waku/interfaces";
|
||||||
import { createLightNode } from "@waku/sdk";
|
import { createLightNode } from "@waku/sdk";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
|
||||||
import { makeLogFileName, NimGoNode, tearDownNodes } from "../src/index.js";
|
import { makeLogFileName, ServiceNode, tearDownNodes } from "../src/index.js";
|
||||||
|
|
||||||
describe("Use static and several ENR trees for bootstrap", function () {
|
describe("Use static and several ENR trees for bootstrap", function () {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
|
@ -18,7 +18,7 @@ describe("Use static and several ENR trees for bootstrap", function () {
|
||||||
it("", async function () {
|
it("", async function () {
|
||||||
this.timeout(10_000);
|
this.timeout(10_000);
|
||||||
|
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start();
|
await nwaku.start();
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
|
|
||||||
|
|
|
@ -24,18 +24,18 @@ import {
|
||||||
makeLogFileName,
|
makeLogFileName,
|
||||||
NOISE_KEY_1,
|
NOISE_KEY_1,
|
||||||
NOISE_KEY_2,
|
NOISE_KEY_2,
|
||||||
|
ServiceNode,
|
||||||
tearDownNodes
|
tearDownNodes
|
||||||
} from "../src/index.js";
|
} from "../src/index.js";
|
||||||
import { NimGoNode } from "../src/node/node.js";
|
|
||||||
|
|
||||||
const TestContentTopic = "/test/1/waku/utf8";
|
const TestContentTopic = "/test/1/waku/utf8";
|
||||||
|
|
||||||
const TestEncoder = createPlainEncoder({ contentTopic: TestContentTopic });
|
const TestEncoder = createPlainEncoder({ contentTopic: TestContentTopic });
|
||||||
|
|
||||||
describe("Waku Dial [node only]", function () {
|
describe("Waku Dial [node only]", function () {
|
||||||
describe("Interop: NimGoNode", function () {
|
describe("Interop: ServiceNode", function () {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
|
@ -44,7 +44,7 @@ describe("Waku Dial [node only]", function () {
|
||||||
|
|
||||||
it("connects to nwaku", async function () {
|
it("connects to nwaku", async function () {
|
||||||
this.timeout(20_000);
|
this.timeout(20_000);
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
store: true,
|
store: true,
|
||||||
|
@ -77,7 +77,7 @@ describe("Waku Dial [node only]", function () {
|
||||||
expect.fail("uncaughtException", e)
|
expect.fail("uncaughtException", e)
|
||||||
);
|
);
|
||||||
|
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start({
|
await nwaku.start({
|
||||||
filter: true,
|
filter: true,
|
||||||
store: true,
|
store: true,
|
||||||
|
@ -100,7 +100,7 @@ describe("Waku Dial [node only]", function () {
|
||||||
|
|
||||||
describe("Bootstrap", function () {
|
describe("Bootstrap", function () {
|
||||||
let waku: LightNode;
|
let waku: LightNode;
|
||||||
let nwaku: NimGoNode;
|
let nwaku: ServiceNode;
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
|
@ -110,7 +110,7 @@ describe("Waku Dial [node only]", function () {
|
||||||
it("Passing an array", async function () {
|
it("Passing an array", async function () {
|
||||||
this.timeout(10_000);
|
this.timeout(10_000);
|
||||||
|
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start();
|
await nwaku.start();
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
waku = await createLightNode({
|
waku = await createLightNode({
|
||||||
|
@ -133,7 +133,7 @@ describe("Waku Dial [node only]", function () {
|
||||||
it("Using a function", async function () {
|
it("Using a function", async function () {
|
||||||
this.timeout(10_000);
|
this.timeout(10_000);
|
||||||
|
|
||||||
nwaku = new NimGoNode(makeLogFileName(this));
|
nwaku = new ServiceNode(makeLogFileName(this));
|
||||||
await nwaku.start();
|
await nwaku.start();
|
||||||
|
|
||||||
const nwakuMa = await nwaku.getMultiaddrWithId();
|
const nwakuMa = await nwaku.getMultiaddrWithId();
|
||||||
|
|
Loading…
Reference in New Issue