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