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:
Danish Arora 2025-06-20 19:04:51 +05:30 committed by GitHub
parent 7c8d1073b0
commit fecc026dd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 5 deletions

View File

@ -39,6 +39,12 @@ BigInt.prototype.toJSON = function toJSON() {
return Number(this);
};
type NwakuVersion = {
major: number;
minor: number;
patch: number;
};
export class ServiceNode {
private docker?: Dockerode;
private peerId?: PeerId;
@ -48,6 +54,8 @@ export class ServiceNode {
private restPort?: number;
private args?: Args;
public readonly version: NwakuVersion | undefined;
/**
* Convert a [[WakuMessage]] to a [[WakuRelayMessage]]. The latter is used
* by the nwaku JSON-RPC API.
@ -75,6 +83,19 @@ export class ServiceNode {
public constructor(logName: string) {
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 {

View File

@ -29,7 +29,8 @@ async function main() {
stdio: "inherit",
env: {
...process.env,
NODE_ENV: "test"
NODE_ENV: "test",
WAKUNODE_IMAGE: WAKUNODE_IMAGE
}
});

View File

@ -132,7 +132,11 @@ describe("Waku Store, cursor", function () {
).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(
nwaku,
totalMsgs,
@ -166,7 +170,7 @@ describe("Waku Store, cursor", function () {
if (
!(err instanceof Error) ||
!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;
@ -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(
nwaku,
totalMsgs,
@ -202,7 +210,7 @@ describe("Waku Store, cursor", function () {
if (
!(err instanceof Error) ||
!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;