diff --git a/test/functional/pipeline.ts b/test/functional/pipeline.ts index 4b2ae4aa..3ef1942c 100644 --- a/test/functional/pipeline.ts +++ b/test/functional/pipeline.ts @@ -355,7 +355,7 @@ describe("pipeline", function () { }); it("should reload scripts on redis restart (reconnect)", async function () { - const redis = new Redis(); + const redis = new Redis({ connectionName: "load-script-on-reconnect" }); const redis2 = new Redis(); redis.defineCommand("exeecafterreconnect", { numberOfKeys: 0, @@ -366,11 +366,19 @@ describe("pipeline", function () { expect(err).to.equal(null); expect(res).to.equal("OK"); - const clientId = await redis.client("id"); + const client = await redis.client("list").then((clients) => { + const myInfo = clients + .split("\n") + .find((client) => client.includes("load-script-on-reconnect")); + + const match = / addr=([^ ]+)/.exec(myInfo); + if (match) return match[1]; + }); + await redis2 .pipeline([ ["script", "flush"], - ["client", "kill", "id", clientId], + ["client", "kill", "addr", client], ]) .exec();