mirror of https://github.com/waku-org/js-waku.git
fix(tests): append `p2p` with the multiaddrs from ENR (#1817)
* append `p2p` with the multiaddrs from ENR * fix(tests): add p2p checks for ENR multiaddrs * fix(tests): type getter * chore(ci): remove debug flag from nwaku_master and go-waku tests
This commit is contained in:
parent
749d84d5e4
commit
f8e02ab19e
|
@ -87,7 +87,6 @@ jobs:
|
|||
with:
|
||||
nim_wakunode_image: harbor.status.im/wakuorg/nwaku:latest
|
||||
test_type: nwaku-master
|
||||
debug: waku*
|
||||
|
||||
maybe-release:
|
||||
name: release
|
||||
|
|
|
@ -396,19 +396,19 @@ describe("ENR", function () {
|
|||
expect(peerInfo.id.toString()).to.equal(peerId.toString());
|
||||
expect(peerInfo.multiaddrs.length).to.equal(5);
|
||||
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
||||
multiaddr(`/ip4/${ip4}/tcp/${tcp}`).toString()
|
||||
multiaddr(`/ip4/${ip4}/tcp/${tcp}/p2p/${peerId}`).toString()
|
||||
);
|
||||
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
||||
multiaddr(`/ip6/${ip6}/tcp/${tcp}`).toString()
|
||||
multiaddr(`/ip6/${ip6}/tcp/${tcp}/p2p/${peerId}`).toString()
|
||||
);
|
||||
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
||||
multiaddr(`/ip4/${ip4}/udp/${udp}`).toString()
|
||||
multiaddr(`/ip4/${ip4}/udp/${udp}/p2p/${peerId}`).toString()
|
||||
);
|
||||
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
||||
multiaddr(`/ip6/${ip6}/udp/${udp}`).toString()
|
||||
multiaddr(`/ip6/${ip6}/udp/${udp}/p2p/${peerId}`).toString()
|
||||
);
|
||||
expect(peerInfo.multiaddrs.map((ma) => ma.toString())).to.contain(
|
||||
wsMultiaddr.toString()
|
||||
`${wsMultiaddr.toString()}/p2p/${peerId}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -107,7 +107,12 @@ export class ENR extends RawEnr implements IEnr {
|
|||
|
||||
const _multiaddrs = this.multiaddrs ?? [];
|
||||
|
||||
return multiaddrs.concat(_multiaddrs);
|
||||
return multiaddrs.concat(_multiaddrs).map((ma) => {
|
||||
if (this.peerId) {
|
||||
return ma.encapsulate(`/p2p/${this.peerId.toString()}`);
|
||||
}
|
||||
return ma;
|
||||
});
|
||||
}
|
||||
|
||||
get peerInfo(): PeerInfo | undefined {
|
||||
|
|
|
@ -84,7 +84,7 @@ export class ServiceNodesFleet {
|
|||
get type(): "go-waku" | "nwaku" {
|
||||
const nodeType = new Set(
|
||||
this.nodes.map((node) => {
|
||||
return node.type();
|
||||
return node.type;
|
||||
})
|
||||
);
|
||||
if (nodeType.size > 1) {
|
||||
|
|
|
@ -79,7 +79,7 @@ export class ServiceNode {
|
|||
this.logPath = `${LOG_DIR}/wakunode_${logName}.log`;
|
||||
}
|
||||
|
||||
type(): "go-waku" | "nwaku" {
|
||||
get type(): "go-waku" | "nwaku" {
|
||||
return isGoWaku ? "go-waku" : "nwaku";
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ describe("Waku Filter V2: FilterPush", function () {
|
|||
]);
|
||||
|
||||
// For go-waku the message is received (it is possible to send a message with no payload)
|
||||
if (nwaku.type() == "go-waku") {
|
||||
if (nwaku.type == "go-waku") {
|
||||
expect(await messageCollector.waitForMessages(1)).to.eq(true);
|
||||
} else {
|
||||
expect(await messageCollector.waitForMessages(1)).to.eq(false);
|
||||
|
|
|
@ -155,7 +155,7 @@ describe("Waku Light Push: Single Node", function () {
|
|||
messagePayload
|
||||
);
|
||||
|
||||
if (nwaku.type() == "go-waku") {
|
||||
if (nwaku.type == "go-waku") {
|
||||
expect(pushResponse.recipients.length).to.eq(1);
|
||||
expect(await messageCollector.waitForMessages(1)).to.eq(true);
|
||||
messageCollector.verifyReceivedMessage(0, {
|
||||
|
|
|
@ -162,7 +162,7 @@ describe("Waku Store, cursor", function () {
|
|||
expect(messagesAfterCursor.length).to.eql(0);
|
||||
} catch (error) {
|
||||
if (
|
||||
nwaku.type() === "go-waku" &&
|
||||
nwaku.type === "go-waku" &&
|
||||
typeof error === "string" &&
|
||||
error.includes("History response contains an Error: INVALID_CURSOR")
|
||||
) {
|
||||
|
|
|
@ -54,7 +54,7 @@ describe("Waku Store, page size", function () {
|
|||
if (pageSize === 0) {
|
||||
effectivePageSize = 20;
|
||||
} else if (pageSize > 100) {
|
||||
if (nwaku.type() == "go-waku") {
|
||||
if (nwaku.type == "go-waku") {
|
||||
effectivePageSize = 20;
|
||||
} else {
|
||||
effectivePageSize = 100;
|
||||
|
|
Loading…
Reference in New Issue