diff --git a/packages/tests/src/index.ts b/packages/tests/src/index.ts index 43901b03af..6ccde12f94 100644 --- a/packages/tests/src/index.ts +++ b/packages/tests/src/index.ts @@ -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"; diff --git a/packages/tests/src/node/dockerode.ts b/packages/tests/src/lib/dockerode.ts similarity index 99% rename from packages/tests/src/node/dockerode.ts rename to packages/tests/src/lib/dockerode.ts index 8942d98654..8100dbb8e4 100644 --- a/packages/tests/src/node/dockerode.ts +++ b/packages/tests/src/lib/dockerode.ts @@ -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"); diff --git a/packages/tests/src/lib/index.ts b/packages/tests/src/lib/index.ts new file mode 100644 index 0000000000..4e7ab34693 --- /dev/null +++ b/packages/tests/src/lib/index.ts @@ -0,0 +1,2 @@ +export * from "./message_collector.js"; +export * from "./service_node.js"; diff --git a/packages/tests/src/message_collector.ts b/packages/tests/src/lib/message_collector.ts similarity index 97% rename from packages/tests/src/message_collector.ts rename to packages/tests/src/lib/message_collector.ts index 2c60b9f679..c0d714e660 100644 --- a/packages/tests/src/message_collector.ts +++ b/packages/tests/src/lib/message_collector.ts @@ -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 = []; 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"); diff --git a/packages/tests/src/node/node.ts b/packages/tests/src/lib/service_node.ts similarity index 97% rename from packages/tests/src/node/node.ts rename to packages/tests/src/lib/service_node.ts index 54be7a908d..5d3d12e394 100644 --- a/packages/tests/src/node/node.ts +++ b/packages/tests/src/lib/service_node.ts @@ -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"); -} diff --git a/packages/tests/src/node/interfaces.ts b/packages/tests/src/types.ts similarity index 100% rename from packages/tests/src/node/interfaces.ts rename to packages/tests/src/types.ts diff --git a/packages/tests/src/async_fs.ts b/packages/tests/src/utils/async_fs.ts similarity index 95% rename from packages/tests/src/async_fs.ts rename to packages/tests/src/utils/async_fs.ts index c93f695044..a0cc20db7d 100644 --- a/packages/tests/src/async_fs.ts +++ b/packages/tests/src/utils/async_fs.ts @@ -28,3 +28,5 @@ export async function waitForFile(path: string): Promise { } } while (!found); } + +export * from "./log_file.js"; diff --git a/packages/tests/src/utils/base64_utf8.ts b/packages/tests/src/utils/base64_utf8.ts new file mode 100644 index 0000000000..cd522e6b32 --- /dev/null +++ b/packages/tests/src/utils/base64_utf8.ts @@ -0,0 +1,3 @@ +export function base64ToUtf8(b64: string): string { + return Buffer.from(b64, "base64").toString("utf-8"); +} diff --git a/packages/tests/src/delay.ts b/packages/tests/src/utils/delay.ts similarity index 77% rename from packages/tests/src/delay.ts rename to packages/tests/src/utils/delay.ts index 59d8019117..90a6c7a6be 100644 --- a/packages/tests/src/delay.ts +++ b/packages/tests/src/utils/delay.ts @@ -1,3 +1,5 @@ export function delay(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } + +export * from "./async_fs.js"; diff --git a/packages/tests/src/utils.ts b/packages/tests/src/utils/generate_test_data.ts similarity index 100% rename from packages/tests/src/utils.ts rename to packages/tests/src/utils/generate_test_data.ts diff --git a/packages/tests/src/utils/index.ts b/packages/tests/src/utils/index.ts new file mode 100644 index 0000000000..98f0c03a25 --- /dev/null +++ b/packages/tests/src/utils/index.ts @@ -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"; diff --git a/packages/tests/src/log_file.ts b/packages/tests/src/utils/log_file.ts similarity index 100% rename from packages/tests/src/log_file.ts rename to packages/tests/src/utils/log_file.ts diff --git a/packages/tests/src/random_array.ts b/packages/tests/src/utils/random_array.ts similarity index 100% rename from packages/tests/src/random_array.ts rename to packages/tests/src/utils/random_array.ts diff --git a/packages/tests/src/teardown.ts b/packages/tests/src/utils/teardown.ts similarity index 91% rename from packages/tests/src/teardown.ts rename to packages/tests/src/utils/teardown.ts index 033f7bcf6e..5bdee8e448 100644 --- a/packages/tests/src/teardown.ts +++ b/packages/tests/src/utils/teardown.ts @@ -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 { const nNodes = Array.isArray(nwakuNodes) ? nwakuNodes : [nwakuNodes]; diff --git a/packages/tests/src/waitForRemotePeerWithCodec.ts b/packages/tests/src/utils/wait_for_remote_peer_with_codec.ts similarity index 100% rename from packages/tests/src/waitForRemotePeerWithCodec.ts rename to packages/tests/src/utils/wait_for_remote_peer_with_codec.ts diff --git a/packages/tests/tests/connection_manager.spec.ts b/packages/tests/tests/connection_manager.spec.ts index 1978e2e365..370b2bab90 100644 --- a/packages/tests/tests/connection_manager.spec.ts +++ b/packages/tests/tests/connection_manager.spec.ts @@ -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 }); diff --git a/packages/tests/tests/dns-peer-discovery.spec.ts b/packages/tests/tests/dns-peer-discovery.spec.ts index d9d279b3b3..efc8e875b5 100644 --- a/packages/tests/tests/dns-peer-discovery.spec.ts +++ b/packages/tests/tests/dns-peer-discovery.spec.ts @@ -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; diff --git a/packages/tests/tests/enr.node.spec.ts b/packages/tests/tests/enr.node.spec.ts index 5959c31f9f..cdbdbfb13d 100644 --- a/packages/tests/tests/enr.node.spec.ts +++ b/packages/tests/tests/enr.node.spec.ts @@ -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, diff --git a/packages/tests/tests/ephemeral.node.spec.ts b/packages/tests/tests/ephemeral.node.spec.ts index b8c0115e3d..9e2ca1c726 100644 --- a/packages/tests/tests/ephemeral.node.spec.ts +++ b/packages/tests/tests/ephemeral.node.spec.ts @@ -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, diff --git a/packages/tests/tests/filter/multiple_pubsub.node.spec.ts b/packages/tests/tests/filter/multiple_pubsub.node.spec.ts index ba43471fbe..c2d2a1b7d6 100644 --- a/packages/tests/tests/filter/multiple_pubsub.node.spec.ts +++ b/packages/tests/tests/filter/multiple_pubsub.node.spec.ts @@ -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, diff --git a/packages/tests/tests/filter/ping.node.spec.ts b/packages/tests/tests/filter/ping.node.spec.ts index 8a447f9360..53d25443ca 100644 --- a/packages/tests/tests/filter/ping.node.spec.ts +++ b/packages/tests/tests/filter/ping.node.spec.ts @@ -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; diff --git a/packages/tests/tests/filter/push.node.spec.ts b/packages/tests/tests/filter/push.node.spec.ts index db72aba606..b0c07740db 100644 --- a/packages/tests/tests/filter/push.node.spec.ts +++ b/packages/tests/tests/filter/push.node.spec.ts @@ -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; diff --git a/packages/tests/tests/filter/subscribe.node.spec.ts b/packages/tests/tests/filter/subscribe.node.spec.ts index 4e382a47e8..41ca9c7475 100644 --- a/packages/tests/tests/filter/subscribe.node.spec.ts +++ b/packages/tests/tests/filter/subscribe.node.spec.ts @@ -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, diff --git a/packages/tests/tests/filter/unsubscribe.node.spec.ts b/packages/tests/tests/filter/unsubscribe.node.spec.ts index 2ec1588b29..1eea9fffe7 100644 --- a/packages/tests/tests/filter/unsubscribe.node.spec.ts +++ b/packages/tests/tests/filter/unsubscribe.node.spec.ts @@ -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; diff --git a/packages/tests/tests/filter/utils.ts b/packages/tests/tests/filter/utils.ts index c7a929cfa2..64bed3f379 100644 --- a/packages/tests/tests/filter/utils.ts +++ b/packages/tests/tests/filter/utils.ts @@ -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( { diff --git a/packages/tests/tests/light-push/index.node.spec.ts b/packages/tests/tests/light-push/index.node.spec.ts index 048d726629..0dc8ccd405 100644 --- a/packages/tests/tests/light-push/index.node.spec.ts +++ b/packages/tests/tests/light-push/index.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/light-push/multiple_pubsub.node.spec.ts b/packages/tests/tests/light-push/multiple_pubsub.node.spec.ts index 19c08ccf13..fb90c4aff4 100644 --- a/packages/tests/tests/light-push/multiple_pubsub.node.spec.ts +++ b/packages/tests/tests/light-push/multiple_pubsub.node.spec.ts @@ -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, diff --git a/packages/tests/tests/light-push/utils.ts b/packages/tests/tests/light-push/utils.ts index 435b7b50d2..7fdcac0de3 100644 --- a/packages/tests/tests/light-push/utils.ts +++ b/packages/tests/tests/light-push/utils.ts @@ -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 } diff --git a/packages/tests/tests/metadata.spec.ts b/packages/tests/tests/metadata.spec.ts index b8bd961436..0996910815 100644 --- a/packages/tests/tests/metadata.spec.ts +++ b/packages/tests/tests/metadata.spec.ts @@ -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 () { diff --git a/packages/tests/tests/multiaddr.node.spec.ts b/packages/tests/tests/multiaddr.node.spec.ts index a457d62211..8489889870 100644 --- a/packages/tests/tests/multiaddr.node.spec.ts +++ b/packages/tests/tests/multiaddr.node.spec.ts @@ -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(); diff --git a/packages/tests/tests/nwaku.node.spec.ts b/packages/tests/tests/nwaku.node.spec.ts index 9c19968958..b92a6b4dce 100644 --- a/packages/tests/tests/nwaku.node.spec.ts +++ b/packages/tests/tests/nwaku.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/peer_exchange.node.spec.ts b/packages/tests/tests/peer_exchange.node.spec.ts index 996e1e1adc..7a2c26179d 100644 --- a/packages/tests/tests/peer_exchange.node.spec.ts +++ b/packages/tests/tests/peer_exchange.node.spec.ts @@ -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({ diff --git a/packages/tests/tests/relay/interop.node.spec.ts b/packages/tests/tests/relay/interop.node.spec.ts index 1304bc9743..f7ccf5c21c 100644 --- a/packages/tests/tests/relay/interop.node.spec.ts +++ b/packages/tests/tests/relay/interop.node.spec.ts @@ -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(); diff --git a/packages/tests/tests/relay/publish.node.spec.ts b/packages/tests/tests/relay/publish.node.spec.ts index 1f4f8fe1ae..cc6ab5f5b4 100644 --- a/packages/tests/tests/relay/publish.node.spec.ts +++ b/packages/tests/tests/relay/publish.node.spec.ts @@ -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, diff --git a/packages/tests/tests/relay/subscribe.node.spec.ts b/packages/tests/tests/relay/subscribe.node.spec.ts index 324820bf89..db7b6d376c 100644 --- a/packages/tests/tests/relay/subscribe.node.spec.ts +++ b/packages/tests/tests/relay/subscribe.node.spec.ts @@ -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 () { diff --git a/packages/tests/tests/sharding/peer_management.spec.ts b/packages/tests/tests/sharding/peer_management.spec.ts index fcaacf097b..c3348907e1 100644 --- a/packages/tests/tests/sharding/peer_management.spec.ts +++ b/packages/tests/tests/sharding/peer_management.spec.ts @@ -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 () { diff --git a/packages/tests/tests/sharding/running_nodes.spec.ts b/packages/tests/tests/sharding/running_nodes.spec.ts index 31df0f3d30..6f08572a4f 100644 --- a/packages/tests/tests/sharding/running_nodes.spec.ts +++ b/packages/tests/tests/sharding/running_nodes.spec.ts @@ -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 }); }); diff --git a/packages/tests/tests/store/cursor.node.spec.ts b/packages/tests/tests/store/cursor.node.spec.ts index 55bfe97d2a..f54b75e00a 100644 --- a/packages/tests/tests/store/cursor.node.spec.ts +++ b/packages/tests/tests/store/cursor.node.spec.ts @@ -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(); }); diff --git a/packages/tests/tests/store/error_handling.node.spec.ts b/packages/tests/tests/store/error_handling.node.spec.ts index 148f76a6a8..8f09ff0a60 100644 --- a/packages/tests/tests/store/error_handling.node.spec.ts +++ b/packages/tests/tests/store/error_handling.node.spec.ts @@ -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); diff --git a/packages/tests/tests/store/index.node.spec.ts b/packages/tests/tests/store/index.node.spec.ts index c5e2c8e127..efec0e904b 100644 --- a/packages/tests/tests/store/index.node.spec.ts +++ b/packages/tests/tests/store/index.node.spec.ts @@ -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"] }), diff --git a/packages/tests/tests/store/multiple_pubsub.spec.ts b/packages/tests/tests/store/multiple_pubsub.spec.ts index 74ad7219f1..a3477beb17 100644 --- a/packages/tests/tests/store/multiple_pubsub.spec.ts +++ b/packages/tests/tests/store/multiple_pubsub.spec.ts @@ -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], diff --git a/packages/tests/tests/store/order.node.spec.ts b/packages/tests/tests/store/order.node.spec.ts index 9701807a05..2c4282bfdc 100644 --- a/packages/tests/tests/store/order.node.spec.ts +++ b/packages/tests/tests/store/order.node.spec.ts @@ -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(); }); diff --git a/packages/tests/tests/store/page_size.node.spec.ts b/packages/tests/tests/store/page_size.node.spec.ts index c4bfee0757..a7be22dccb 100644 --- a/packages/tests/tests/store/page_size.node.spec.ts +++ b/packages/tests/tests/store/page_size.node.spec.ts @@ -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(); }); diff --git a/packages/tests/tests/store/sorting.node.spec.ts b/packages/tests/tests/store/sorting.node.spec.ts index 7fa3ca6410..c60392e141 100644 --- a/packages/tests/tests/store/sorting.node.spec.ts +++ b/packages/tests/tests/store/sorting.node.spec.ts @@ -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(); }); diff --git a/packages/tests/tests/store/time_filter.node.spec.ts b/packages/tests/tests/store/time_filter.node.spec.ts index fea2cd2efc..2da4fd9cdf 100644 --- a/packages/tests/tests/store/time_filter.node.spec.ts +++ b/packages/tests/tests/store/time_filter.node.spec.ts @@ -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 diff --git a/packages/tests/tests/store/utils.ts b/packages/tests/tests/store/utils.ts index 252df84cb0..3390311355 100644 --- a/packages/tests/tests/store/utils.ts +++ b/packages/tests/tests/store/utils.ts @@ -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 { 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 { diff --git a/packages/tests/tests/utils.spec.ts b/packages/tests/tests/utils.spec.ts index 9d2b0e9f93..fcb1cacccd 100644 --- a/packages/tests/tests/utils.spec.ts +++ b/packages/tests/tests/utils.spec.ts @@ -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, diff --git a/packages/tests/tests/wait_for_remote_peer.node.spec.ts b/packages/tests/tests/wait_for_remote_peer.node.spec.ts index 3ca2263d94..a984c650f6 100644 --- a/packages/tests/tests/wait_for_remote_peer.node.spec.ts +++ b/packages/tests/tests/wait_for_remote_peer.node.spec.ts @@ -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, diff --git a/packages/tests/tests/waku.node.optional.spec.ts b/packages/tests/tests/waku.node.optional.spec.ts index 5a684e820c..98cca925ec 100644 --- a/packages/tests/tests/waku.node.optional.spec.ts +++ b/packages/tests/tests/waku.node.optional.spec.ts @@ -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(); diff --git a/packages/tests/tests/waku.node.spec.ts b/packages/tests/tests/waku.node.spec.ts index bfd812517d..1126cdb76b 100644 --- a/packages/tests/tests/waku.node.spec.ts +++ b/packages/tests/tests/waku.node.spec.ts @@ -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();