Skip to content

Commit 038b3a9

Browse files
committed
Add a valid slots table to mock server in tests that expect to be able to connect using the Cluster client
1 parent bfc5b06 commit 038b3a9

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

test/functional/cluster/connect.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,12 @@ describe("cluster:connect", () => {
391391

392392
describe("multiple reconnect", () => {
393393
it("should reconnect after multiple consecutive disconnect(true) are called", (done) => {
394-
new MockServer(30001);
394+
const slotTable = [[0, 16383, ["127.0.0.1", 30001]]];
395+
new MockServer(30001, (argv) => {
396+
if (argv[0] === "cluster" && argv[1] === "SLOTS") {
397+
return slotTable;
398+
}
399+
});
395400
const cluster = new Cluster([{ host: "127.0.0.1", port: "30001" }], {
396401
enableReadyCheck: false,
397402
});

test/functional/cluster/disconnection.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ describe("disconnection", () => {
99
});
1010

1111
it("should clear all timers on disconnect", (done) => {
12-
const server = new MockServer(30000);
12+
const slotTable = [[0, 16383, ["127.0.0.1", 30000]]];
13+
const server = new MockServer(30000, (argv) => {
14+
if (argv[0] === "cluster" && argv[1] === "SLOTS") {
15+
return slotTable;
16+
}
17+
});
1318

1419
const setIntervalCalls = sinon.spy(global, "setInterval");
1520
const clearIntervalCalls = sinon.spy(global, "clearInterval");

0 commit comments

Comments
 (0)