mirror of https://github.com/waku-org/js-waku.git
chore: test agains Fleets and add optional tests (#1432)
* test Prod and Test fleets in CI * compute predefined nodes once * remove async * add optional test step * fix command
This commit is contained in:
parent
af5d613e47
commit
75808ffc9d
|
@ -85,6 +85,23 @@ jobs:
|
|||
name: nwaku-logs
|
||||
path: packages/tests/log/
|
||||
|
||||
node_optional:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
WAKUNODE_IMAGE: "statusteam/nim-waku:v0.18.0"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_JS }}
|
||||
|
||||
- uses: ./.github/actions/npm
|
||||
- run: npm run build:esm
|
||||
- run: npm run test:optional --workspace=@waku/tests
|
||||
env:
|
||||
DEBUG: ""
|
||||
|
||||
node_with_go_waku_master:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
|
|
|
@ -27559,13 +27559,13 @@
|
|||
},
|
||||
"packages/core": {
|
||||
"name": "@waku/core",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.22",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@noble/hashes": "^1.3.0",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/proto": "0.0.5",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/utils": "0.0.10",
|
||||
"debug": "^4.3.4",
|
||||
"it-all": "^3.0.2",
|
||||
"it-length-prefixed": "^9.0.1",
|
||||
|
@ -27630,13 +27630,13 @@
|
|||
},
|
||||
"packages/dns-discovery": {
|
||||
"name": "@waku/dns-discovery",
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.16",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@libp2p/interface-peer-discovery": "^2.0.0",
|
||||
"@libp2p/interfaces": "^3.3.2",
|
||||
"@waku/enr": "0.0.15",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/enr": "0.0.16",
|
||||
"@waku/utils": "0.0.10",
|
||||
"debug": "^4.3.4",
|
||||
"dns-query": "^0.11.2",
|
||||
"hi-base32": "^0.5.1",
|
||||
|
@ -27653,7 +27653,7 @@
|
|||
"@rollup/plugin-node-resolve": "^15.0.2",
|
||||
"@types/chai": "^4.3.4",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"chai": "^4.3.7",
|
||||
"cspell": "^6.31.1",
|
||||
"karma": "^6.4.1",
|
||||
|
@ -27685,7 +27685,7 @@
|
|||
},
|
||||
"packages/enr": {
|
||||
"name": "@waku/enr",
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.16",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@ethersproject/rlp": "^5.7.0",
|
||||
|
@ -27693,7 +27693,7 @@
|
|||
"@libp2p/peer-id": "^2.0.4",
|
||||
"@multiformats/multiaddr": "^12.0.0",
|
||||
"@noble/secp256k1": "^1.7.1",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/utils": "0.0.10",
|
||||
"debug": "^4.3.4",
|
||||
"js-sha3": "^0.8.0"
|
||||
},
|
||||
|
@ -27707,7 +27707,7 @@
|
|||
"@types/chai": "^4.3.4",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"chai": "^4.3.7",
|
||||
"cspell": "^6.31.1",
|
||||
"karma": "^6.4.1",
|
||||
|
@ -27730,7 +27730,7 @@
|
|||
},
|
||||
"packages/interfaces": {
|
||||
"name": "@waku/interfaces",
|
||||
"version": "0.0.16",
|
||||
"version": "0.0.17",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@chainsafe/libp2p-gossipsub": "^9.1.0",
|
||||
|
@ -27770,14 +27770,14 @@
|
|||
},
|
||||
"packages/message-encryption": {
|
||||
"name": "@waku/message-encryption",
|
||||
"version": "0.0.19",
|
||||
"version": "0.0.20",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@noble/secp256k1": "^1.7.1",
|
||||
"@waku/core": "0.0.21",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/core": "0.0.22",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/proto": "0.0.5",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/utils": "0.0.10",
|
||||
"debug": "^4.3.4",
|
||||
"js-sha3": "^0.8.0"
|
||||
},
|
||||
|
@ -27832,11 +27832,11 @@
|
|||
},
|
||||
"packages/message-hash": {
|
||||
"name": "@waku/message-hash",
|
||||
"version": "0.1.5",
|
||||
"version": "0.1.6",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@noble/hashes": "^1.2.0",
|
||||
"@waku/utils": "0.0.9"
|
||||
"@waku/utils": "0.0.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^24.0.1",
|
||||
|
@ -27846,7 +27846,7 @@
|
|||
"@types/debug": "^4.1.7",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"chai": "^4.3.7",
|
||||
"cspell": "^6.28.0",
|
||||
"fast-check": "^3.7.0",
|
||||
|
@ -27872,16 +27872,16 @@
|
|||
},
|
||||
"packages/peer-exchange": {
|
||||
"name": "@waku/peer-exchange",
|
||||
"version": "0.0.14",
|
||||
"version": "0.0.15",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@libp2p/interface-peer-discovery": "^2.0.0",
|
||||
"@libp2p/interfaces": "^3.3.2",
|
||||
"@waku/core": "0.0.21",
|
||||
"@waku/enr": "0.0.15",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/core": "0.0.22",
|
||||
"@waku/enr": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/proto": "0.0.5",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/utils": "0.0.10",
|
||||
"debug": "^4.3.4",
|
||||
"it-all": "^3.0.2",
|
||||
"it-length-prefixed": "^9.0.1",
|
||||
|
@ -27965,15 +27965,15 @@
|
|||
},
|
||||
"packages/relay": {
|
||||
"name": "@waku/relay",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.5",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@chainsafe/libp2p-gossipsub": "^9.1.0",
|
||||
"@noble/hashes": "^1.3.0",
|
||||
"@waku/core": "0.0.21",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/core": "0.0.22",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/proto": "0.0.5",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/utils": "0.0.10",
|
||||
"chai": "^4.3.7",
|
||||
"debug": "^4.3.4",
|
||||
"fast-check": "^3.8.1"
|
||||
|
@ -27995,17 +27995,17 @@
|
|||
},
|
||||
"packages/sdk": {
|
||||
"name": "@waku/sdk",
|
||||
"version": "0.0.17",
|
||||
"version": "0.0.18",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@chainsafe/libp2p-noise": "^12.0.1",
|
||||
"@libp2p/mplex": "^8.0.4",
|
||||
"@libp2p/websockets": "^6.0.3",
|
||||
"@waku/core": "0.0.21",
|
||||
"@waku/dns-discovery": "0.0.15",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/relay": "0.0.4",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/core": "0.0.22",
|
||||
"@waku/dns-discovery": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/relay": "0.0.5",
|
||||
"@waku/utils": "0.0.10",
|
||||
"libp2p": "^0.45.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -28326,7 +28326,7 @@
|
|||
},
|
||||
"packages/utils": {
|
||||
"name": "@waku/utils",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.10",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.4",
|
||||
|
@ -28340,7 +28340,7 @@
|
|||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.2",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"cspell": "^6.31.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.8.8",
|
||||
|
@ -32143,9 +32143,9 @@
|
|||
"@types/mocha": "^10.0.1",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/proto": "0.0.5",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/utils": "0.0.10",
|
||||
"chai": "^4.3.7",
|
||||
"cspell": "^6.31.1",
|
||||
"debug": "^4.3.4",
|
||||
|
@ -32193,9 +32193,9 @@
|
|||
"@rollup/plugin-node-resolve": "^15.0.2",
|
||||
"@types/chai": "^4.3.4",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/enr": "0.0.15",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/enr": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/utils": "0.0.10",
|
||||
"chai": "^4.3.7",
|
||||
"cspell": "^6.31.1",
|
||||
"debug": "^4.3.4",
|
||||
|
@ -32240,8 +32240,8 @@
|
|||
"@types/chai": "^4.3.4",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/utils": "0.0.10",
|
||||
"chai": "^4.3.7",
|
||||
"cspell": "^6.31.1",
|
||||
"debug": "^4.3.4",
|
||||
|
@ -32309,10 +32309,10 @@
|
|||
"@types/chai": "^4.3.4",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/core": "0.0.21",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/core": "0.0.22",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/proto": "0.0.5",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/utils": "0.0.10",
|
||||
"chai": "^4.3.7",
|
||||
"cspell": "^6.31.1",
|
||||
"debug": "^4.3.4",
|
||||
|
@ -32356,8 +32356,8 @@
|
|||
"@types/debug": "^4.1.7",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/utils": "0.0.10",
|
||||
"chai": "^4.3.7",
|
||||
"cspell": "^6.28.0",
|
||||
"fast-check": "^3.7.0",
|
||||
|
@ -32393,11 +32393,11 @@
|
|||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.2",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/core": "0.0.21",
|
||||
"@waku/enr": "0.0.15",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/core": "0.0.22",
|
||||
"@waku/enr": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/proto": "0.0.5",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/utils": "0.0.10",
|
||||
"chai": "^4.3.7",
|
||||
"cspell": "^6.31.1",
|
||||
"debug": "^4.3.4",
|
||||
|
@ -32459,10 +32459,10 @@
|
|||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.2",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/core": "0.0.21",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/core": "0.0.22",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/proto": "0.0.5",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/utils": "0.0.10",
|
||||
"chai": "^4.3.7",
|
||||
"debug": "^4.3.4",
|
||||
"fast-check": "^3.8.1",
|
||||
|
@ -32497,11 +32497,11 @@
|
|||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.2",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/core": "0.0.21",
|
||||
"@waku/dns-discovery": "0.0.15",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/relay": "0.0.4",
|
||||
"@waku/utils": "0.0.9",
|
||||
"@waku/core": "0.0.22",
|
||||
"@waku/dns-discovery": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"@waku/relay": "0.0.5",
|
||||
"@waku/utils": "0.0.10",
|
||||
"cspell": "^6.31.1",
|
||||
"interface-datastore": "^7.0.4",
|
||||
"libp2p": "^0.45.9",
|
||||
|
@ -32709,7 +32709,7 @@
|
|||
"@rollup/plugin-json": "^6.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.0.2",
|
||||
"@waku/build-utils": "*",
|
||||
"@waku/interfaces": "0.0.16",
|
||||
"@waku/interfaces": "0.0.17",
|
||||
"cspell": "^6.31.1",
|
||||
"debug": "^4.3.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"extension": ["ts"],
|
||||
"spec": "tests/*.spec.ts",
|
||||
"require": ["ts-node/register", "isomorphic-fetch"],
|
||||
"loader": "ts-node/esm",
|
||||
"node-option": [
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
"check:lint": "eslint src tests",
|
||||
"check:spelling": "cspell \"{README.md,{tests,src}/**/*.ts}\"",
|
||||
"check:tsc": "tsc -p tsconfig.dev.json",
|
||||
"test": "run-s test:*",
|
||||
"test:node": "node ./src/run-tests.js",
|
||||
"test": "node ./src/run-tests.js \"tests/**/!(*.optional).spec.ts\"",
|
||||
"test:optional": "node ./src/run-tests.js \"tests/**/@(*.optional).spec.ts\"",
|
||||
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -25,6 +25,7 @@ async function main() {
|
|||
"ts-node/register",
|
||||
"--project",
|
||||
"./tsconfig.dev.json",
|
||||
...process.argv.slice(2),
|
||||
],
|
||||
{
|
||||
stdio: "inherit",
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
import { bootstrap } from "@libp2p/bootstrap";
|
||||
import tests from "@libp2p/interface-peer-discovery-compliance-tests";
|
||||
import {
|
||||
Fleet,
|
||||
getPredefinedBootstrapNodes,
|
||||
} from "@waku/core/lib/predefined_bootstrap_nodes";
|
||||
import type { LightNode, PeerInfo } from "@waku/interfaces";
|
||||
import {
|
||||
PeerExchangeCodec,
|
||||
|
@ -19,54 +14,12 @@ import { makeLogFileName } from "../src/log_file.js";
|
|||
import { NimGoNode } from "../src/node/node.js";
|
||||
|
||||
describe("Peer Exchange", () => {
|
||||
describe("Auto Discovery", function () {
|
||||
let waku: LightNode;
|
||||
|
||||
afterEach(async function () {
|
||||
await waku?.stop();
|
||||
});
|
||||
|
||||
it("connection with fleet nodes", async function () {
|
||||
// skipping in CI as this test demonstrates Peer Exchange working with the test fleet
|
||||
// but not with locally run nwaku nodes
|
||||
if (process.env.CI) {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
this.timeout(50_000);
|
||||
|
||||
waku = await createLightNode({
|
||||
libp2p: {
|
||||
peerDiscovery: [
|
||||
bootstrap({ list: getPredefinedBootstrapNodes(Fleet.Test, 3) }),
|
||||
wakuPeerExchangeDiscovery(),
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
await waku.start();
|
||||
|
||||
const foundPxPeer = await new Promise<boolean>((resolve) => {
|
||||
const testNodes = getPredefinedBootstrapNodes(Fleet.Test, 3);
|
||||
waku.libp2p.addEventListener("peer:discovery", (evt) => {
|
||||
const peerId = evt.detail.id.toString();
|
||||
const isBootstrapNode = testNodes.find((n) => n.includes(peerId));
|
||||
if (!isBootstrapNode) {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
expect(foundPxPeer).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
describe("Locally Run Nodes", () => {
|
||||
let waku: LightNode;
|
||||
let nwaku1: NimGoNode;
|
||||
let nwaku2: NimGoNode;
|
||||
|
||||
beforeEach(async function () {
|
||||
beforeEach(function () {
|
||||
nwaku1 = new NimGoNode(makeLogFileName(this) + "1");
|
||||
nwaku2 = new NimGoNode(makeLogFileName(this) + "2");
|
||||
});
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
import { bootstrap } from "@libp2p/bootstrap";
|
||||
import {
|
||||
Fleet,
|
||||
getPredefinedBootstrapNodes,
|
||||
} from "@waku/core/lib/predefined_bootstrap_nodes";
|
||||
import type { LightNode } from "@waku/interfaces";
|
||||
import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange";
|
||||
import { createLightNode } from "@waku/sdk";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Peer Exchange", () => {
|
||||
describe("Auto Discovery", function () {
|
||||
let waku: LightNode;
|
||||
|
||||
afterEach(async function () {
|
||||
await waku?.stop();
|
||||
});
|
||||
|
||||
const testCases: [Fleet, number][] = [
|
||||
[Fleet.Test, 2], // on test fleet there are only 3 peers
|
||||
[Fleet.Prod, 3],
|
||||
];
|
||||
|
||||
testCases.map(([name, nodes]) => {
|
||||
it(`should discover peers other than used for bootstrapping on ${name} fleet`, async function () {
|
||||
this.timeout(50_000);
|
||||
const predefinedNodes = getPredefinedBootstrapNodes(name, nodes);
|
||||
|
||||
waku = await createLightNode({
|
||||
libp2p: {
|
||||
peerDiscovery: [
|
||||
bootstrap({ list: predefinedNodes }),
|
||||
wakuPeerExchangeDiscovery(),
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
await waku.start();
|
||||
|
||||
const foundPxPeer = await new Promise<boolean>((resolve) => {
|
||||
waku.libp2p.addEventListener("peer:discovery", (evt) => {
|
||||
const peerId = evt.detail.id.toString();
|
||||
const isBootstrapNode = predefinedNodes.find((n) =>
|
||||
n.includes(peerId)
|
||||
);
|
||||
if (!isBootstrapNode) {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
expect(foundPxPeer).to.be.true;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue