@@ -197,7 +197,6 @@ describe(`test with scripts`, () => {
197
197
} , GLOBAL . SENTINEL . WITH_SCRIPT )
198
198
} ) ;
199
199
200
-
201
200
describe ( `test with functions` , ( ) => {
202
201
testUtils . testWithClientSentinel ( 'with function' , async sentinel => {
203
202
await sentinel . functionLoad (
@@ -377,12 +376,9 @@ describe(`test with masterPoolSize 2`, () => {
377
376
} , GLOBAL . SENTINEL . WITH_MASTER_POOL_SIZE_2 ) ;
378
377
} ) ;
379
378
380
-
381
- // TODO: Figure out how to modify the test utils
382
- // so it would have fine grained controll over
383
- // sentinel
384
- // it should somehow replicate the `SentinelFramework` object functionallities
385
379
async function steadyState ( frame : SentinelFramework ) {
380
+ // wait a bit to ensure that sentinels are seeing eachother
381
+ await setTimeout ( 2000 )
386
382
let checkedMaster = false ;
387
383
let checkedReplicas = false ;
388
384
while ( ! checkedMaster || ! checkedReplicas ) {
@@ -430,7 +426,7 @@ async function steadyState(frame: SentinelFramework) {
430
426
}
431
427
}
432
428
433
- describe . skip ( 'legacy tests' , ( ) => {
429
+ describe ( 'legacy tests' , ( ) => {
434
430
const config : RedisSentinelConfig = { sentinelName : "test" , numberOfNodes : 3 , password : undefined } ;
435
431
const frame = new SentinelFramework ( config ) ;
436
432
let tracer = new Array < string > ( ) ;
@@ -439,42 +435,30 @@ describe.skip('legacy tests', () => {
439
435
let longestTestDelta = 0 ;
440
436
let last : number ;
441
437
442
- before ( async function ( ) {
443
- this . timeout ( 15000 ) ;
444
-
445
- last = Date . now ( ) ;
446
-
447
- function deltaMeasurer ( ) {
448
- const delta = Date . now ( ) - last ;
449
- if ( delta > longestDelta ) {
450
- longestDelta = delta ;
451
- }
452
- if ( delta > longestTestDelta ) {
453
- longestTestDelta = delta ;
454
- }
455
- if ( ! stopMeasuringBlocking ) {
456
- last = Date . now ( ) ;
457
- setImmediate ( deltaMeasurer ) ;
458
- }
459
- }
460
- setImmediate ( deltaMeasurer ) ;
461
- await frame . spawnRedisSentinel ( ) ;
462
- } ) ;
463
-
464
- after ( async function ( ) {
465
- this . timeout ( 15000 ) ;
466
-
467
- stopMeasuringBlocking = true ;
468
-
469
- await frame . cleanup ( ) ;
470
- } )
471
438
472
439
describe ( 'Sentinel Client' , function ( ) {
473
440
let sentinel : RedisSentinelType < RedisModules , RedisFunctions , RedisScripts , RespVersions , TypeMapping > | undefined ;
474
441
475
442
beforeEach ( async function ( ) {
476
- this . timeout ( 0 ) ;
477
-
443
+ this . timeout ( 15000 ) ;
444
+
445
+ last = Date . now ( ) ;
446
+
447
+ function deltaMeasurer ( ) {
448
+ const delta = Date . now ( ) - last ;
449
+ if ( delta > longestDelta ) {
450
+ longestDelta = delta ;
451
+ }
452
+ if ( delta > longestTestDelta ) {
453
+ longestTestDelta = delta ;
454
+ }
455
+ if ( ! stopMeasuringBlocking ) {
456
+ last = Date . now ( ) ;
457
+ setImmediate ( deltaMeasurer ) ;
458
+ }
459
+ }
460
+ setImmediate ( deltaMeasurer ) ;
461
+ await frame . spawnRedisSentinel ( ) ;
478
462
await frame . getAllRunning ( ) ;
479
463
await steadyState ( frame ) ;
480
464
longestTestDelta = 0 ;
@@ -522,6 +506,10 @@ describe.skip('legacy tests', () => {
522
506
await sentinel . destroy ( ) ;
523
507
sentinel = undefined ;
524
508
}
509
+
510
+ stopMeasuringBlocking = true ;
511
+
512
+ await frame . cleanup ( ) ;
525
513
} )
526
514
527
515
it ( 'use' , async function ( ) {
@@ -863,7 +851,6 @@ describe.skip('legacy tests', () => {
863
851
864
852
it ( 'shutdown sentinel node' , async function ( ) {
865
853
this . timeout ( 60000 ) ;
866
-
867
854
sentinel = frame . getSentinelClient ( ) ;
868
855
sentinel . setTracer ( tracer ) ;
869
856
sentinel . on ( "error" , ( ) => { } ) ;
@@ -1020,7 +1007,7 @@ describe.skip('legacy tests', () => {
1020
1007
this . timeout ( 30000 ) ;
1021
1008
const csc = new BasicPooledClientSideCache ( ) ;
1022
1009
1023
- sentinel = frame . getSentinelClient ( { nodeClientOptions : { RESP : 3 } , clientSideCache : csc , masterPoolSize : 5 } ) ;
1010
+ sentinel = frame . getSentinelClient ( { nodeClientOptions : { RESP : 3 as const } , RESP : 3 as const , clientSideCache : csc , masterPoolSize : 5 } ) ;
1024
1011
await sentinel . connect ( ) ;
1025
1012
1026
1013
await sentinel . set ( 'x' , 1 ) ;
0 commit comments