From d5d85e95b9d97f915778ce0bd0d533f41a5bc6aa Mon Sep 17 00:00:00 2001 From: Martin Slota Date: Mon, 10 Jun 2024 18:53:30 +0200 Subject: [PATCH] Add a valid slots table to mock server in tests that expect to be able to connect using the Cluster client Signed-off-by: Martin Slota --- test/functional/cluster/connect.ts | 7 ++++++- test/functional/cluster/disconnection.ts | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/functional/cluster/connect.ts b/test/functional/cluster/connect.ts index a2346f23..c0caf114 100644 --- a/test/functional/cluster/connect.ts +++ b/test/functional/cluster/connect.ts @@ -391,7 +391,12 @@ describe("cluster:connect", () => { describe("multiple reconnect", () => { it("should reconnect after multiple consecutive disconnect(true) are called", (done) => { - new MockServer(30001); + const slotTable = [[0, 16383, ["127.0.0.1", 30001]]]; + new MockServer(30001, (argv) => { + if (argv[0] === "cluster" && argv[1] === "SLOTS") { + return slotTable; + } + }); const cluster = new Cluster([{ host: "127.0.0.1", port: "30001" }], { enableReadyCheck: false, }); diff --git a/test/functional/cluster/disconnection.ts b/test/functional/cluster/disconnection.ts index 40e33e01..1adafcb3 100644 --- a/test/functional/cluster/disconnection.ts +++ b/test/functional/cluster/disconnection.ts @@ -9,7 +9,12 @@ describe("disconnection", () => { }); it("should clear all timers on disconnect", (done) => { - const server = new MockServer(30000); + const slotTable = [[0, 16383, ["127.0.0.1", 30000]]]; + const server = new MockServer(30000, (argv) => { + if (argv[0] === "cluster" && argv[1] === "SLOTS") { + return slotTable; + } + }); const setIntervalCalls = sinon.spy(global, "setInterval"); const clearIntervalCalls = sinon.spy(global, "clearInterval");