mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-02 13:53:12 +00:00
fix: DIRVER -> DRIVER typo in nwaku (#2406)
* fix: DIRVER -> DRIVER nwaku * chore: empty commit * chore: access CI/test env vars and conditionally check test * fix: undefined nwaku version * chore: improve splitting * simplify, test error string only for new versions --------- Co-authored-by: Sasha <oleksandr@status.im>
This commit is contained in:
parent
7c8d1073b0
commit
fecc026dd7
@ -39,6 +39,12 @@ BigInt.prototype.toJSON = function toJSON() {
|
|||||||
return Number(this);
|
return Number(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type NwakuVersion = {
|
||||||
|
major: number;
|
||||||
|
minor: number;
|
||||||
|
patch: number;
|
||||||
|
};
|
||||||
|
|
||||||
export class ServiceNode {
|
export class ServiceNode {
|
||||||
private docker?: Dockerode;
|
private docker?: Dockerode;
|
||||||
private peerId?: PeerId;
|
private peerId?: PeerId;
|
||||||
@ -48,6 +54,8 @@ export class ServiceNode {
|
|||||||
private restPort?: number;
|
private restPort?: number;
|
||||||
private args?: Args;
|
private args?: Args;
|
||||||
|
|
||||||
|
public readonly version: NwakuVersion | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a [[WakuMessage]] to a [[WakuRelayMessage]]. The latter is used
|
* Convert a [[WakuMessage]] to a [[WakuRelayMessage]]. The latter is used
|
||||||
* by the nwaku JSON-RPC API.
|
* by the nwaku JSON-RPC API.
|
||||||
@ -75,6 +83,19 @@ export class ServiceNode {
|
|||||||
|
|
||||||
public constructor(logName: string) {
|
public constructor(logName: string) {
|
||||||
this.logPath = `${LOG_DIR}/wakunode_${logName}.log`;
|
this.logPath = `${LOG_DIR}/wakunode_${logName}.log`;
|
||||||
|
const nwakuImage = process.env.WAKUNODE_IMAGE;
|
||||||
|
const nwakuVersion = nwakuImage?.split(":")[1];
|
||||||
|
|
||||||
|
if (nwakuVersion && nwakuVersion.startsWith("v")) {
|
||||||
|
const versionParts = nwakuVersion.substring(1).split(".");
|
||||||
|
if (versionParts.length === 3) {
|
||||||
|
this.version = {
|
||||||
|
major: Number(versionParts[0]),
|
||||||
|
minor: Number(versionParts[1]),
|
||||||
|
patch: Number(versionParts[2])
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get containerName(): string | undefined {
|
public get containerName(): string | undefined {
|
||||||
|
|||||||
@ -29,7 +29,8 @@ async function main() {
|
|||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
NODE_ENV: "test"
|
NODE_ENV: "test",
|
||||||
|
WAKUNODE_IMAGE: WAKUNODE_IMAGE
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -132,7 +132,11 @@ describe("Waku Store, cursor", function () {
|
|||||||
).to.be.eq(bytesToUtf8(messages[messages.length - 1].payload));
|
).to.be.eq(bytesToUtf8(messages[messages.length - 1].payload));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Passing invalid cursor", async function () {
|
it("Passing invalid cursor for nwaku > 0.35.1", async function () {
|
||||||
|
if (nwaku.version && nwaku.version.minor < 36) {
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
|
|
||||||
await sendMessages(
|
await sendMessages(
|
||||||
nwaku,
|
nwaku,
|
||||||
totalMsgs,
|
totalMsgs,
|
||||||
@ -166,7 +170,7 @@ describe("Waku Store, cursor", function () {
|
|||||||
if (
|
if (
|
||||||
!(err instanceof Error) ||
|
!(err instanceof Error) ||
|
||||||
!err.message.includes(
|
!err.message.includes(
|
||||||
`Store query failed with status code: 300, description: BAD_RESPONSE: archive error: DIRVER_ERROR: cursor not found`
|
"Store query failed with status code: 300, description: BAD_RESPONSE: archive error: DRIVER_ERROR: cursor not found"
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
throw err;
|
throw err;
|
||||||
@ -174,7 +178,11 @@ describe("Waku Store, cursor", function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Passing cursor with wrong pubsubTopic", async function () {
|
it("Passing cursor with wrong pubsubTopic for nwaku > 0.35.1", async function () {
|
||||||
|
if (nwaku.version && nwaku.version.minor < 36) {
|
||||||
|
this.skip();
|
||||||
|
}
|
||||||
|
|
||||||
await sendMessages(
|
await sendMessages(
|
||||||
nwaku,
|
nwaku,
|
||||||
totalMsgs,
|
totalMsgs,
|
||||||
@ -202,7 +210,7 @@ describe("Waku Store, cursor", function () {
|
|||||||
if (
|
if (
|
||||||
!(err instanceof Error) ||
|
!(err instanceof Error) ||
|
||||||
!err.message.includes(
|
!err.message.includes(
|
||||||
`Store query failed with status code: 300, description: BAD_RESPONSE: archive error: DIRVER_ERROR: cursor not found`
|
"Store query failed with status code: 300, description: BAD_RESPONSE: archive error: DRIVER_ERROR: cursor not found"
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
throw err;
|
throw err;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user