Skip to content

Commit e48e1e8

Browse files
author
Ruben Bridgewater
committed
Windows fixes
Skip redis process spawn on windows for now
1 parent 31a2d84 commit e48e1e8

File tree

7 files changed

+51
-38
lines changed

7 files changed

+51
-38
lines changed

test/auth.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ var config = require("./lib/config");
55
var helper = require('./helper');
66
var redis = config.redis;
77

8+
if (process.platform === 'win32') {
9+
// TODO: Fix redis process spawn on windows
10+
return;
11+
}
12+
813
describe("client authentication", function () {
914
before(function (done) {
1015
helper.stopRedis(function () {
@@ -237,6 +242,7 @@ describe("client authentication", function () {
237242
});
238243

239244
after(function (done) {
245+
if (helper.redisProcess().spawnFailed()) return done();
240246
helper.stopRedis(function () {
241247
helper.startRedis('./conf/redis.conf', done);
242248
});

test/conect.slave.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ var rp;
88
var path = require('path');
99
var redis = config.redis;
1010

11+
if (process.platform === 'win32') {
12+
// TODO: Fix redis process spawn on windows
13+
return;
14+
}
15+
1116
describe('master slave sync', function () {
1217
var master = null;
1318
var slave = null;
@@ -19,6 +24,7 @@ describe('master slave sync', function () {
1924
});
2025

2126
before(function (done) {
27+
if (helper.redisProcess().spawnFailed()) return done();
2228
master = redis.createClient({
2329
password: 'porkchopsandwiches'
2430
});
@@ -78,6 +84,7 @@ describe('master slave sync', function () {
7884
});
7985

8086
after(function (done) {
87+
if (helper.redisProcess().spawnFailed()) return done();
8188
var end = helper.callFuncAfter(done, 3);
8289
rp.stop(end);
8390
slave.end(true);

test/connection.spec.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,20 +257,21 @@ describe("connection tests", function () {
257257
client.once('ready', done);
258258
});
259259

260-
if (process.platform !== 'win32') {
261-
it("connect with path provided in the options object", function (done) {
262-
client = redis.createClient({
263-
path: '/tmp/redis.sock',
264-
parser: parser,
265-
connect_timeout: 1000
266-
});
260+
it("connect with path provided in the options object", function (done) {
261+
if (process.platform === 'win32') {
262+
this.skip();
263+
}
264+
client = redis.createClient({
265+
path: '/tmp/redis.sock',
266+
parser: parser,
267+
connect_timeout: 1000
268+
});
267269

268-
var end = helper.callFuncAfter(done, 2);
270+
var end = helper.callFuncAfter(done, 2);
269271

270-
client.once('ready', end);
271-
client.set('foo', 'bar', end);
272-
});
273-
}
272+
client.once('ready', end);
273+
client.set('foo', 'bar', end);
274+
});
274275

275276
it("connects correctly with args", function (done) {
276277
client = redis.createClient.apply(redis.createClient, args);

test/helper.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,6 @@ function startRedis (conf, done, port) {
1515
}, path.resolve(__dirname, conf), port);
1616
}
1717

18-
function startStunnel(done) {
19-
StunnelProcess.start(function (err, _stunnel_process) {
20-
stunnel_process = _stunnel_process;
21-
return done(err);
22-
}, path.resolve(__dirname, './conf'));
23-
}
24-
25-
function stopStunnel(done) {
26-
if (stunnel_process) {
27-
StunnelProcess.stop(stunnel_process, done);
28-
} else {
29-
done();
30-
}
31-
}
32-
3318
// don't start redis every time we
3419
// include this helper file!
3520
if (!process.env.REDIS_TESTS_STARTED) {
@@ -52,8 +37,19 @@ module.exports = {
5237
rp.stop(done);
5338
},
5439
startRedis: startRedis,
55-
stopStunnel: stopStunnel,
56-
startStunnel: startStunnel,
40+
stopStunnel: function (done) {
41+
if (stunnel_process) {
42+
StunnelProcess.stop(stunnel_process, done);
43+
} else {
44+
done();
45+
}
46+
},
47+
startStunnel: function (done) {
48+
StunnelProcess.start(function (err, _stunnel_process) {
49+
stunnel_process = _stunnel_process;
50+
return done(err);
51+
}, path.resolve(__dirname, './conf'));
52+
},
5753
isNumber: function (expected, done) {
5854
return function (err, results) {
5955
assert.strictEqual(null, err, "expected " + expected + ", got error: " + err);

test/multi.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe("The 'multi' method", function () {
7373
describe('pipeline limit', function () {
7474

7575
it('do not exceed maximum string size', function (done) {
76-
this.timeout(12000); // Windows tests on 0.10 are slow
76+
this.timeout(25000); // Windows tests are horribly slow
7777
// Triggers a RangeError: Invalid string length if not handled properly
7878
client = redis.createClient();
7979
var multi = client.multi();

test/rename.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ var config = require("./lib/config");
55
var helper = require('./helper');
66
var redis = config.redis;
77

8+
if (process.platform === 'win32') {
9+
// TODO: Fix redis process spawn on windows
10+
return;
11+
}
12+
813
describe("rename commands", function () {
914
before(function (done) {
1015
helper.stopRedis(function () {
@@ -18,6 +23,7 @@ describe("rename commands", function () {
1823
var client = null;
1924

2025
beforeEach(function(done) {
26+
if (helper.redisProcess().spawnFailed()) return done();
2127
client = redis.createClient({
2228
rename_commands: {
2329
set: '807081f5afa96845a02816a28b7258c3',
@@ -32,6 +38,7 @@ describe("rename commands", function () {
3238
});
3339

3440
afterEach(function () {
41+
if (helper.redisProcess().spawnFailed()) return;
3542
client.end(true);
3643
});
3744

@@ -132,6 +139,7 @@ describe("rename commands", function () {
132139
});
133140

134141
after(function (done) {
142+
if (helper.redisProcess().spawnFailed()) return done();
135143
helper.stopRedis(function () {
136144
helper.startRedis('./conf/redis.conf', done);
137145
});

test/tls.spec.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,21 @@ describe("TLS connection tests", function () {
3232
skip = true;
3333
console.warn('\nTravis does not support stunnel right now. Skipping tests.\nCheck: https://github.com/travis-ci/apt-package-whitelist/issues/403\n');
3434
}
35-
if (skip) {
36-
done();
37-
return;
38-
}
35+
if (skip) return done();
3936
helper.stopStunnel(function () {
4037
helper.startStunnel(done);
4138
});
4239
});
4340

4441
after(function (done) {
45-
if (skip) {
46-
done();
47-
return;
48-
}
42+
if (skip) return done();
4943
helper.stopStunnel(done);
5044
});
5145

5246
var client;
5347

5448
afterEach(function () {
49+
if (skip) return;
5550
client.end(true);
5651
});
5752

0 commit comments

Comments
 (0)