diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3c4161be2..2dfc3c2417 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,6 +97,52 @@ jobs: name: nwaku-logs path: log/ + node_with_go_waku: + runs-on: ubuntu-latest + env: + GO_WAKU_VERSION: "0.2.1" + WAKU_SERVICE_NODE_DIR: ./go-waku + WAKU_SERVICE_NODE_BIN: ./waku + WAKU_SERVICE_NODE_PARAMS: "--min-relay-peers-to-publish=0" # Can be removed once https://github.com/status-im/nwaku/issues/1004 is done + DEBUG: "waku*" + steps: + - uses: actions/checkout@v3 + + - name: Get go-waku + shell: bash + run: | + pwd + mkdir -p go-waku/ + cd go-waku + wget "https://github.com/status-im/go-waku/releases/download/v${GO_WAKU_VERSION}/gowaku-${GO_WAKU_VERSION}-x86_64.deb" + sudo apt install ./gowaku-${GO_WAKU_VERSION}-x86_64.deb + cp $(which waku) ./ + + - name: Ensure go-waku is ready + shell: bash + run: | + uname -a + cd "${WAKU_SERVICE_NODE_DIR}" + "${WAKU_SERVICE_NODE_BIN}" --version + + - name: Install NodeJS + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + + - uses: bahmutov/npm-install@v1 + + - run: npm run test:node + env: + DEBUG: "waku:nwaku*,waku:test*" + + - name: Upload logs on failure + uses: actions/upload-artifact@v2 + if: failure() + with: + name: go-waku-logs + path: log/ + release_next: runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/master' diff --git a/src/lib/peer_discovery_dns/dns.ts b/src/lib/peer_discovery_dns/dns.ts index 27a528efee..c8a15178ae 100644 --- a/src/lib/peer_discovery_dns/dns.ts +++ b/src/lib/peer_discovery_dns/dns.ts @@ -64,7 +64,15 @@ export class DnsNodeDiscovery { this._errorTolerance, () => this._search(domain, context) ); - dbg("retrieved peers: ", peers); + dbg( + "retrieved peers: ", + peers.map((peer) => { + return { + id: peer.peerId?.toString(), + multiaddrs: peer.multiaddrs?.map((ma) => ma.toString()), + }; + }) + ); return peers; } diff --git a/src/lib/wait_for_remote_peer.node.spec.ts b/src/lib/wait_for_remote_peer.node.spec.ts index 859ea36244..c48bef1fbb 100644 --- a/src/lib/wait_for_remote_peer.node.spec.ts +++ b/src/lib/wait_for_remote_peer.node.spec.ts @@ -99,6 +99,7 @@ describe("Wait for remote peer", function () { relay: false, lightpush: false, filter: false, + persistMessages: true, }); const multiAddrWithId = await nwaku.getMultiaddrWithId(); @@ -125,6 +126,7 @@ describe("Wait for remote peer", function () { relay: false, lightpush: false, filter: false, + persistMessages: true, }); const multiAddrWithId = await nwaku.getMultiaddrWithId(); diff --git a/src/lib/waku_filter/index.node.spec.ts b/src/lib/waku_filter/index.node.spec.ts index 75a766253c..f02949e018 100644 --- a/src/lib/waku_filter/index.node.spec.ts +++ b/src/lib/waku_filter/index.node.spec.ts @@ -22,7 +22,7 @@ describe("Waku Filter", () => { }); beforeEach(async function () { - this.timeout(10000); + this.timeout(15000); nwaku = new Nwaku(makeLogFileName(this)); await nwaku.start({ filter: true, lightpush: true }); waku = await createWaku({ @@ -46,6 +46,10 @@ describe("Waku Filter", () => { expect(msg.payloadAsUtf8).to.eq(messageText); }; await waku.filter.subscribe(callback, [TestContentTopic]); + // As the filter protocol does not cater for a ack of subscription + // we cannot know whether the subscription happened. Something we want to + // correct in future versions of the protocol. + await delay(200); const message = await WakuMessage.fromUtf8String( messageText, TestContentTopic @@ -66,6 +70,7 @@ describe("Waku Filter", () => { expect(msg.contentTopic).to.eq(TestContentTopic); }; await waku.filter.subscribe(callback, [TestContentTopic]); + await delay(200); await waku.lightPush.push( await WakuMessage.fromUtf8String("Filtering works!", TestContentTopic) ); @@ -89,6 +94,7 @@ describe("Waku Filter", () => { const unsubscribe = await waku.filter.subscribe(callback, [ TestContentTopic, ]); + await delay(200); await waku.lightPush.push( await WakuMessage.fromUtf8String( "This should be received", @@ -97,6 +103,7 @@ describe("Waku Filter", () => { ); await delay(100); await unsubscribe(); + await delay(200); await waku.lightPush.push( await WakuMessage.fromUtf8String( "This should not be received", diff --git a/src/test_utils/nwaku.ts b/src/test_utils/nwaku.ts index 2f70cce648..4cbffc3019 100644 --- a/src/test_utils/nwaku.ts +++ b/src/test_utils/nwaku.ts @@ -18,6 +18,7 @@ import { WakuMessage } from "../lib/waku_message"; import * as proto from "../proto/message"; import { existsAsync, mkdirAsync, openAsync } from "./async_fs"; +import { delay } from "./delay"; import waitForLine from "./log_file"; const dbg = debug("waku:nwaku"); @@ -181,6 +182,7 @@ export class Nwaku { dbg(`Waiting to see '${NODE_READY_LOG_LINE}' in nwaku logs`); await this.waitForLog(NODE_READY_LOG_LINE, 15000); + if (process.env.CI) await delay(100); dbg("nwaku node has been started"); } @@ -249,12 +251,19 @@ export class Nwaku { async getAsymmetricKeyPair(): Promise { this.checkProcess(); - const { seckey, pubkey } = await this.rpcCall<{ + const { privateKey, publicKey, seckey, pubkey } = await this.rpcCall<{ seckey: string; pubkey: string; + privateKey: string; + publicKey: string; }>("get_waku_v2_private_v1_asymmetric_keypair", []); - return { privateKey: seckey, publicKey: pubkey }; + // To be removed once https://github.com/vacp2p/rfc/issues/507 is fixed + if (seckey) { + return { privateKey: seckey, publicKey: pubkey }; + } else { + return { privateKey, publicKey }; + } } async postAsymmetricMessage(