File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -349,7 +349,7 @@ describe('connection tests', function () {
349
349
} ) ;
350
350
} ) ;
351
351
352
- it ( 'clears the socket timeout after a connection has been established' , function ( done ) {
352
+ it ( 'clears connect_timeout on the socket timeout after a connection has been established' , function ( done ) {
353
353
client = redis . createClient ( {
354
354
connect_timeout : 1000
355
355
} ) ;
@@ -374,6 +374,23 @@ describe('connection tests', function () {
374
374
client . on ( 'ready' , done ) ;
375
375
} ) ;
376
376
} ) ;
377
+
378
+ it ( 'set the timeout to socket_timeout after a connection has been established' , function ( done ) {
379
+ client = redis . createClient ( {
380
+ parser : parser ,
381
+ connect_timeout : 1000 ,
382
+ socket_timeout : 2000
383
+ } ) ;
384
+ process . nextTick ( function ( ) {
385
+ assert . strictEqual ( client . stream . _idleTimeout , 1000 ) ;
386
+
387
+ } ) ;
388
+ client . on ( 'connect' , function ( ) {
389
+ assert . strictEqual ( client . stream . _idleTimeout , 2000 ) ;
390
+ assert . strictEqual ( client . stream . listeners ( 'timeout' ) . length , 1 ) ;
391
+ client . on ( 'ready' , done ) ;
392
+ } ) ;
393
+ } ) ;
377
394
378
395
it ( 'connect with host and port provided in the options object' , function ( done ) {
379
396
client = redis . createClient ( {
You can’t perform that action at this time.
0 commit comments