mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-14 11:43:10 +00:00
chore: update tests
This commit is contained in:
parent
87d09f0f41
commit
18c6d3b792
@ -1,9 +1,9 @@
|
||||
import {
|
||||
CreateNodeOptions,
|
||||
DefaultNetworkConfig,
|
||||
IWaku,
|
||||
LightNode,
|
||||
NetworkConfig,
|
||||
ProtocolCreateOptions,
|
||||
Protocols
|
||||
} from "@waku/interfaces";
|
||||
import { createLightNode } from "@waku/sdk";
|
||||
@ -13,6 +13,7 @@ import pRetry from "p-retry";
|
||||
|
||||
import { NOISE_KEY_1 } from "../constants.js";
|
||||
import { ServiceNodesFleet } from "../lib/index.js";
|
||||
import { verifyServiceNodesConnected } from "../lib/service_node.js";
|
||||
import { Args } from "../types.js";
|
||||
|
||||
import { waitForConnections } from "./waitForConnections.js";
|
||||
@ -35,7 +36,9 @@ export async function runMultipleNodes(
|
||||
withoutFilter
|
||||
);
|
||||
|
||||
const wakuOptions: CreateNodeOptions = {
|
||||
await verifyServiceNodesConnected(serviceNodes.nodes);
|
||||
|
||||
const wakuOptions: ProtocolCreateOptions = {
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
libp2p: {
|
||||
addresses: { listen: ["/ip4/0.0.0.0/tcp/0/ws"] }
|
||||
@ -57,17 +60,18 @@ export async function runMultipleNodes(
|
||||
derivePubsubTopicsFromNetworkConfig(networkConfig)
|
||||
);
|
||||
|
||||
const wakuConnections = waku.libp2p.getConnections();
|
||||
|
||||
if (wakuConnections.length < 1) {
|
||||
throw new Error(`Expected at least 1 connection for js-waku.`);
|
||||
}
|
||||
|
||||
await node.waitForLog(waku.libp2p.peerId.toString(), 100);
|
||||
}
|
||||
|
||||
await waitForConnections(numServiceNodes, waku);
|
||||
|
||||
const wakuConnections = waku.libp2p.getConnections();
|
||||
if (wakuConnections.length < numServiceNodes) {
|
||||
throw new Error(
|
||||
`Expected at least ${numServiceNodes} connections for js-waku.`
|
||||
);
|
||||
}
|
||||
|
||||
return [serviceNodes, waku];
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ const runTests = (strictNodeCheck: boolean): void => {
|
||||
const pushResponse = await waku.lightPush.send(TestEncoder, {
|
||||
payload: utf8ToBytes(testItem.value)
|
||||
});
|
||||
expect(pushResponse.successes.length).to.eq(numServiceNodes);
|
||||
expect(pushResponse.successes.length).to.greaterThanOrEqual(1);
|
||||
|
||||
expect(
|
||||
await serviceNodes.messageCollector.waitForMessages(1, {
|
||||
@ -73,7 +73,7 @@ const runTests = (strictNodeCheck: boolean): void => {
|
||||
payload: utf8ToBytes(generateMessageText(i))
|
||||
});
|
||||
|
||||
expect(pushResponse.successes.length).to.eq(numServiceNodes);
|
||||
expect(pushResponse.successes.length).to.greaterThanOrEqual(1);
|
||||
}
|
||||
|
||||
expect(
|
||||
@ -119,7 +119,7 @@ const runTests = (strictNodeCheck: boolean): void => {
|
||||
customEncoder,
|
||||
messagePayload
|
||||
);
|
||||
expect(pushResponse.successes.length).to.eq(numServiceNodes);
|
||||
expect(pushResponse.successes.length).to.greaterThanOrEqual(1);
|
||||
|
||||
expect(
|
||||
await serviceNodes.messageCollector.waitForMessages(1, {
|
||||
@ -156,7 +156,7 @@ const runTests = (strictNodeCheck: boolean): void => {
|
||||
customTestEncoder,
|
||||
messagePayload
|
||||
);
|
||||
expect(pushResponse.successes.length).to.eq(numServiceNodes);
|
||||
expect(pushResponse.successes.length).to.greaterThanOrEqual(1);
|
||||
|
||||
expect(
|
||||
await serviceNodes.messageCollector.waitForMessages(1, {
|
||||
@ -190,7 +190,7 @@ const runTests = (strictNodeCheck: boolean): void => {
|
||||
);
|
||||
|
||||
if (serviceNodes.type == "go-waku") {
|
||||
expect(pushResponse.successes.length).to.eq(numServiceNodes);
|
||||
expect(pushResponse.successes.length).to.greaterThanOrEqual(1);
|
||||
expect(
|
||||
await serviceNodes.messageCollector.waitForMessages(1, {
|
||||
pubsubTopic: TestPubsubTopic
|
||||
@ -229,7 +229,7 @@ const runTests = (strictNodeCheck: boolean): void => {
|
||||
payload: utf8ToBytes(messageText),
|
||||
rateLimitProof: rateLimitProof
|
||||
});
|
||||
expect(pushResponse.successes.length).to.eq(numServiceNodes);
|
||||
expect(pushResponse.successes.length).to.greaterThanOrEqual(1);
|
||||
|
||||
expect(
|
||||
await serviceNodes.messageCollector.waitForMessages(1, {
|
||||
@ -253,7 +253,7 @@ const runTests = (strictNodeCheck: boolean): void => {
|
||||
payload: utf8ToBytes(messageText),
|
||||
timestamp: new Date(testItem)
|
||||
});
|
||||
expect(pushResponse.successes.length).to.eq(numServiceNodes);
|
||||
expect(pushResponse.successes.length).to.greaterThanOrEqual(1);
|
||||
|
||||
expect(
|
||||
await serviceNodes.messageCollector.waitForMessages(1, {
|
||||
@ -274,7 +274,7 @@ const runTests = (strictNodeCheck: boolean): void => {
|
||||
const pushResponse = await waku.lightPush.send(TestEncoder, {
|
||||
payload: bigPayload
|
||||
});
|
||||
expect(pushResponse.successes.length).to.greaterThan(0);
|
||||
expect(pushResponse.successes.length).to.greaterThanOrEqual(1);
|
||||
});
|
||||
|
||||
it("Fails to push message bigger that 1MB", async function () {
|
||||
|
||||
@ -174,7 +174,7 @@ describe("Static Sharding: Running Nodes", function () {
|
||||
shard: 3
|
||||
};
|
||||
|
||||
it.only("configure the node with multiple pubsub topics", async function () {
|
||||
it("configure the node with multiple pubsub topics", async function () {
|
||||
[serviceNodes, waku] = await runMultipleNodes(
|
||||
this.ctx,
|
||||
shardInfoBothShards,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user