@@ -15,14 +15,29 @@ var tls_options = {
1515
1616var tls_port = 6380 ;
1717
18+ if ( process . platform === 'win32' ) {
19+ return ;
20+ }
21+
22+ // Wait until stunnel4 is in the travis whitelist
23+ // Check: https://github.com/travis-ci/apt-package-whitelist/issues/403
24+ // If this is merged, remove the travis env checks
1825describe ( "TLS connection tests" , function ( ) {
1926 before ( function ( done ) {
27+ if ( process . env . TRAVIS === 'true' ) {
28+ done ( ) ;
29+ return ;
30+ }
2031 helper . stopStunnel ( function ( ) {
2132 helper . startStunnel ( done ) ;
2233 } ) ;
2334 } ) ;
2435
2536 after ( function ( done ) {
37+ if ( process . env . TRAVIS === 'true' ) {
38+ done ( ) ;
39+ return ;
40+ }
2641 helper . stopStunnel ( done ) ;
2742 } ) ;
2843
@@ -33,13 +48,12 @@ describe("TLS connection tests", function () {
3348 var client ;
3449
3550 afterEach ( function ( ) {
36- if ( client ) {
37- client . end ( ) ;
38- }
51+ client . end ( true ) ;
3952 } ) ;
4053
4154 describe ( "on lost connection" , function ( ) {
4255 it ( "emit an error after max retry attempts and do not try to reconnect afterwards" , function ( done ) {
56+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
4357 var max_attempts = 4 ;
4458 var options = {
4559 parser : parser ,
@@ -69,6 +83,7 @@ describe("TLS connection tests", function () {
6983 } ) ;
7084
7185 it ( "emit an error after max retry timeout and do not try to reconnect afterwards" , function ( done ) {
86+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
7287 var connect_timeout = 500 ; // in ms
7388 client = redis . createClient ( {
7489 parser : parser ,
@@ -97,6 +112,7 @@ describe("TLS connection tests", function () {
97112 } ) ;
98113
99114 it ( "end connection while retry is still ongoing" , function ( done ) {
115+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
100116 var connect_timeout = 1000 ; // in ms
101117 client = redis . createClient ( {
102118 parser : parser ,
@@ -116,6 +132,7 @@ describe("TLS connection tests", function () {
116132 } ) ;
117133
118134 it ( "can not connect with wrong host / port in the options object" , function ( done ) {
135+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
119136 var options = {
120137 host : 'somewhere' ,
121138 max_attempts : 1 ,
@@ -136,6 +153,7 @@ describe("TLS connection tests", function () {
136153 describe ( "when not connected" , function ( ) {
137154
138155 it ( "connect with host and port provided in the options object" , function ( done ) {
156+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
139157 client = redis . createClient ( {
140158 host : 'localhost' ,
141159 parser : parser ,
@@ -150,6 +168,7 @@ describe("TLS connection tests", function () {
150168 } ) ;
151169
152170 it ( "connects correctly with args" , function ( done ) {
171+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
153172 var args_host = args [ 1 ] ;
154173 var args_options = args [ 2 ] || { } ;
155174 args_options . tls = tls_options ;
@@ -166,6 +185,7 @@ describe("TLS connection tests", function () {
166185
167186 if ( ip === 'IPv4' ) {
168187 it ( 'allows connecting with the redis url and no auth and options as second parameter' , function ( done ) {
188+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
169189 var options = {
170190 detect_buffers : false ,
171191 magic : Math . random ( ) ,
@@ -176,6 +196,7 @@ describe("TLS connection tests", function () {
176196 // verify connection is using TCP, not UNIX socket
177197 assert . strictEqual ( client . connection_options . host , config . HOST [ ip ] ) ;
178198 assert . strictEqual ( client . connection_options . port , tls_port ) ;
199+ assert ( typeof client . stream . getCipher === 'function' ) ;
179200 // verify passed options are in use
180201 assert . strictEqual ( client . options . magic , options . magic ) ;
181202 client . on ( "ready" , function ( ) {
@@ -184,6 +205,7 @@ describe("TLS connection tests", function () {
184205 } ) ;
185206
186207 it ( 'allows connecting with the redis url and no auth and options as third parameter' , function ( done ) {
208+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
187209 client = redis . createClient ( 'redis://' + config . HOST [ ip ] + ':' + tls_port , null , {
188210 detect_buffers : false ,
189211 tls : tls_options
0 commit comments