Skip to content

Commit 41cd617

Browse files
Adapt legacy sentinel tests to use the new test utils
1 parent c5692a9 commit 41cd617

File tree

5 files changed

+240
-276
lines changed

5 files changed

+240
-276
lines changed

packages/client/lib/sentinel/index.spec.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ describe('RedisSentinel', () => {
171171
});
172172
});
173173

174-
describe.skip(`test with scripts`, () => {
174+
describe(`test with scripts`, () => {
175175
testUtils.testWithClientSentinel('with script', async sentinel => {
176176
const [, reply] = await Promise.all([
177177
sentinel.set('key', '2'),
@@ -197,8 +197,7 @@ describe.skip(`test with scripts`, () => {
197197
}, GLOBAL.SENTINEL.WITH_SCRIPT)
198198
});
199199

200-
201-
describe.skip(`test with functions`, () => {
200+
describe(`test with functions`, () => {
202201
testUtils.testWithClientSentinel('with function', async sentinel => {
203202
await sentinel.functionLoad(
204203
MATH_FUNCTION.code,
@@ -238,7 +237,7 @@ describe.skip(`test with functions`, () => {
238237
}, GLOBAL.SENTINEL.WITH_FUNCTION);
239238
});
240239

241-
describe.skip(`test with modules`, () => {
240+
describe(`test with modules`, () => {
242241
testUtils.testWithClientSentinel('with module', async sentinel => {
243242
const resp = await sentinel.bf.add('key', 'item')
244243
assert.equal(resp, true);
@@ -260,7 +259,7 @@ describe.skip(`test with modules`, () => {
260259
}, GLOBAL.SENTINEL.WITH_MODULE);
261260
});
262261

263-
describe.skip(`test with replica pool size 1`, () => {
262+
describe(`test with replica pool size 1`, () => {
264263
testUtils.testWithClientSentinel('client lease', async sentinel => {
265264
sentinel.on("error", () => { });
266265

@@ -302,7 +301,7 @@ describe.skip(`test with replica pool size 1`, () => {
302301
}, GLOBAL.SENTINEL.WITH_REPLICA_POOL_SIZE_1);
303302
});
304303

305-
describe.skip(`test with masterPoolSize 2, reserve client true`, () => {
304+
describe(`test with masterPoolSize 2, reserve client true`, () => {
306305
// TODO: flaky test, sometimes fails with `promise1 === null`
307306
testUtils.testWithClientSentinel('reserve client, takes a client out of pool', async sentinel => {
308307
const promise1 = sentinel.use(
@@ -325,7 +324,7 @@ describe.skip(`test with masterPoolSize 2, reserve client true`, () => {
325324
}, Object.assign(GLOBAL.SENTINEL.WITH_RESERVE_CLIENT_MASTER_POOL_SIZE_2, {skipTest: true}));
326325
});
327326

328-
describe.skip(`test with masterPoolSize 2`, () => {
327+
describe(`test with masterPoolSize 2`, () => {
329328
testUtils.testWithClientSentinel('multple clients', async sentinel => {
330329
sentinel.on("error", () => { });
331330

@@ -383,6 +382,8 @@ describe.skip(`test with masterPoolSize 2`, () => {
383382
// sentinel
384383
// it should somehow replicate the `SentinelFramework` object functionallities
385384
async function steadyState(frame: SentinelFramework) {
385+
// wait a bit to ensure that sentinels are seeing eachother
386+
await setTimeout(2000)
386387
let checkedMaster = false;
387388
let checkedReplicas = false;
388389
while (!checkedMaster || !checkedReplicas) {
@@ -463,7 +464,6 @@ describe('legacy tests', () => {
463464
}
464465
setImmediate(deltaMeasurer);
465466
await frame.spawnRedisSentinel();
466-
467467
await frame.getAllRunning();
468468
await steadyState(frame);
469469
longestTestDelta = 0;
@@ -856,7 +856,6 @@ describe('legacy tests', () => {
856856

857857
it('shutdown sentinel node', async function () {
858858
this.timeout(60000);
859-
860859
sentinel = frame.getSentinelClient();
861860
sentinel.setTracer(tracer);
862861
sentinel.on("error", () => { });
@@ -1013,7 +1012,7 @@ describe('legacy tests', () => {
10131012
this.timeout(30000);
10141013
const csc = new BasicPooledClientSideCache();
10151014

1016-
sentinel = frame.getSentinelClient({nodeClientOptions: {RESP: 3}, clientSideCache: csc, masterPoolSize: 5});
1015+
sentinel = frame.getSentinelClient({nodeClientOptions: {RESP: 3 as const}, RESP: 3 as const, clientSideCache: csc, masterPoolSize: 5});
10171016
await sentinel.connect();
10181017

10191018
await sentinel.set('x', 1);

0 commit comments

Comments
 (0)