File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ exports.connectHandler = function (self) {
29
29
self . _readyCheck ( function ( err , info ) {
30
30
if ( err ) {
31
31
self . flushQueue ( new Error ( 'Ready check failed: ' + err . message ) ) ;
32
+ if ( ! self . condition . auth && err . message . split ( ' ' ) [ 0 ] === 'NOAUTH' ) {
33
+ self . emit ( 'authError' , err ) ;
34
+ }
32
35
} else {
33
36
self . serverInfo = info ;
34
37
if ( self . connector . check ( info ) ) {
Original file line number Diff line number Diff line change @@ -70,4 +70,19 @@ describe('auth', function () {
70
70
done ( ) ;
71
71
} ) ;
72
72
} ) ;
73
+
74
+ it ( 'should emit "authError" when password is not provided' , function ( done ) {
75
+ var server = new MockServer ( 17379 , function ( argv ) {
76
+ if ( argv [ 0 ] === 'info' ) {
77
+ return new Error ( 'NOAUTH Authentication required.' ) ;
78
+ }
79
+ } ) ;
80
+ var redis = new Redis ( { port : 17379 } ) ;
81
+ redis . on ( 'authError' , function ( error ) {
82
+ expect ( error ) . to . have . property ( 'message' , 'NOAUTH Authentication required.' ) ;
83
+ redis . disconnect ( ) ;
84
+ server . disconnect ( ) ;
85
+ done ( ) ;
86
+ } ) ;
87
+ } ) ;
73
88
} ) ;
You can’t perform that action at this time.
0 commit comments