@@ -15,14 +15,29 @@ var tls_options = {
15
15
16
16
var tls_port = 6380 ;
17
17
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
18
25
describe ( "TLS connection tests" , function ( ) {
19
26
before ( function ( done ) {
27
+ if ( process . env . TRAVIS === 'true' ) {
28
+ done ( ) ;
29
+ return ;
30
+ }
20
31
helper . stopStunnel ( function ( ) {
21
32
helper . startStunnel ( done ) ;
22
33
} ) ;
23
34
} ) ;
24
35
25
36
after ( function ( done ) {
37
+ if ( process . env . TRAVIS === 'true' ) {
38
+ done ( ) ;
39
+ return ;
40
+ }
26
41
helper . stopStunnel ( done ) ;
27
42
} ) ;
28
43
@@ -33,13 +48,12 @@ describe("TLS connection tests", function () {
33
48
var client ;
34
49
35
50
afterEach ( function ( ) {
36
- if ( client ) {
37
- client . end ( ) ;
38
- }
51
+ client . end ( true ) ;
39
52
} ) ;
40
53
41
54
describe ( "on lost connection" , function ( ) {
42
55
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 ( ) ;
43
57
var max_attempts = 4 ;
44
58
var options = {
45
59
parser : parser ,
@@ -69,6 +83,7 @@ describe("TLS connection tests", function () {
69
83
} ) ;
70
84
71
85
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 ( ) ;
72
87
var connect_timeout = 500 ; // in ms
73
88
client = redis . createClient ( {
74
89
parser : parser ,
@@ -97,6 +112,7 @@ describe("TLS connection tests", function () {
97
112
} ) ;
98
113
99
114
it ( "end connection while retry is still ongoing" , function ( done ) {
115
+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
100
116
var connect_timeout = 1000 ; // in ms
101
117
client = redis . createClient ( {
102
118
parser : parser ,
@@ -116,6 +132,7 @@ describe("TLS connection tests", function () {
116
132
} ) ;
117
133
118
134
it ( "can not connect with wrong host / port in the options object" , function ( done ) {
135
+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
119
136
var options = {
120
137
host : 'somewhere' ,
121
138
max_attempts : 1 ,
@@ -136,6 +153,7 @@ describe("TLS connection tests", function () {
136
153
describe ( "when not connected" , function ( ) {
137
154
138
155
it ( "connect with host and port provided in the options object" , function ( done ) {
156
+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
139
157
client = redis . createClient ( {
140
158
host : 'localhost' ,
141
159
parser : parser ,
@@ -150,6 +168,7 @@ describe("TLS connection tests", function () {
150
168
} ) ;
151
169
152
170
it ( "connects correctly with args" , function ( done ) {
171
+ if ( process . env . TRAVIS === 'true' ) this . skip ( ) ;
153
172
var args_host = args [ 1 ] ;
154
173
var args_options = args [ 2 ] || { } ;
155
174
args_options . tls = tls_options ;
@@ -166,6 +185,7 @@ describe("TLS connection tests", function () {
166
185
167
186
if ( ip === 'IPv4' ) {
168
187
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 ( ) ;
169
189
var options = {
170
190
detect_buffers : false ,
171
191
magic : Math . random ( ) ,
@@ -176,6 +196,7 @@ describe("TLS connection tests", function () {
176
196
// verify connection is using TCP, not UNIX socket
177
197
assert . strictEqual ( client . connection_options . host , config . HOST [ ip ] ) ;
178
198
assert . strictEqual ( client . connection_options . port , tls_port ) ;
199
+ assert ( typeof client . stream . getCipher === 'function' ) ;
179
200
// verify passed options are in use
180
201
assert . strictEqual ( client . options . magic , options . magic ) ;
181
202
client . on ( "ready" , function ( ) {
@@ -184,6 +205,7 @@ describe("TLS connection tests", function () {
184
205
} ) ;
185
206
186
207
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 ( ) ;
187
209
client = redis . createClient ( 'redis://' + config . HOST [ ip ] + ':' + tls_port , null , {
188
210
detect_buffers : false ,
189
211
tls : tls_options
0 commit comments