1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Windows fixes

Skip redis process spawn on windows for now
This commit is contained in:
Ruben Bridgewater
2016-03-01 19:55:26 +01:00
parent 31a2d843e8
commit e48e1e845f
7 changed files with 52 additions and 39 deletions

View File

@@ -5,6 +5,11 @@ var config = require("./lib/config");
var helper = require('./helper'); var helper = require('./helper');
var redis = config.redis; var redis = config.redis;
if (process.platform === 'win32') {
// TODO: Fix redis process spawn on windows
return;
}
describe("client authentication", function () { describe("client authentication", function () {
before(function (done) { before(function (done) {
helper.stopRedis(function () { helper.stopRedis(function () {
@@ -237,6 +242,7 @@ describe("client authentication", function () {
}); });
after(function (done) { after(function (done) {
if (helper.redisProcess().spawnFailed()) return done();
helper.stopRedis(function () { helper.stopRedis(function () {
helper.startRedis('./conf/redis.conf', done); helper.startRedis('./conf/redis.conf', done);
}); });

View File

@@ -8,6 +8,11 @@ var rp;
var path = require('path'); var path = require('path');
var redis = config.redis; var redis = config.redis;
if (process.platform === 'win32') {
// TODO: Fix redis process spawn on windows
return;
}
describe('master slave sync', function () { describe('master slave sync', function () {
var master = null; var master = null;
var slave = null; var slave = null;
@@ -19,6 +24,7 @@ describe('master slave sync', function () {
}); });
before(function (done) { before(function (done) {
if (helper.redisProcess().spawnFailed()) return done();
master = redis.createClient({ master = redis.createClient({
password: 'porkchopsandwiches' password: 'porkchopsandwiches'
}); });
@@ -78,6 +84,7 @@ describe('master slave sync', function () {
}); });
after(function (done) { after(function (done) {
if (helper.redisProcess().spawnFailed()) return done();
var end = helper.callFuncAfter(done, 3); var end = helper.callFuncAfter(done, 3);
rp.stop(end); rp.stop(end);
slave.end(true); slave.end(true);

View File

@@ -257,20 +257,21 @@ describe("connection tests", function () {
client.once('ready', done); client.once('ready', done);
}); });
if (process.platform !== 'win32') { it("connect with path provided in the options object", function (done) {
it("connect with path provided in the options object", function (done) { if (process.platform === 'win32') {
client = redis.createClient({ this.skip();
path: '/tmp/redis.sock', }
parser: parser, client = redis.createClient({
connect_timeout: 1000 path: '/tmp/redis.sock',
}); parser: parser,
connect_timeout: 1000
var end = helper.callFuncAfter(done, 2);
client.once('ready', end);
client.set('foo', 'bar', end);
}); });
}
var end = helper.callFuncAfter(done, 2);
client.once('ready', end);
client.set('foo', 'bar', end);
});
it("connects correctly with args", function (done) { it("connects correctly with args", function (done) {
client = redis.createClient.apply(redis.createClient, args); client = redis.createClient.apply(redis.createClient, args);

View File

@@ -15,21 +15,6 @@ function startRedis (conf, done, port) {
}, path.resolve(__dirname, conf), port); }, path.resolve(__dirname, conf), port);
} }
function startStunnel(done) {
StunnelProcess.start(function (err, _stunnel_process) {
stunnel_process = _stunnel_process;
return done(err);
}, path.resolve(__dirname, './conf'));
}
function stopStunnel(done) {
if (stunnel_process) {
StunnelProcess.stop(stunnel_process, done);
} else {
done();
}
}
// don't start redis every time we // don't start redis every time we
// include this helper file! // include this helper file!
if (!process.env.REDIS_TESTS_STARTED) { if (!process.env.REDIS_TESTS_STARTED) {
@@ -52,8 +37,19 @@ module.exports = {
rp.stop(done); rp.stop(done);
}, },
startRedis: startRedis, startRedis: startRedis,
stopStunnel: stopStunnel, stopStunnel: function (done) {
startStunnel: startStunnel, if (stunnel_process) {
StunnelProcess.stop(stunnel_process, done);
} else {
done();
}
},
startStunnel: function (done) {
StunnelProcess.start(function (err, _stunnel_process) {
stunnel_process = _stunnel_process;
return done(err);
}, path.resolve(__dirname, './conf'));
},
isNumber: function (expected, done) { isNumber: function (expected, done) {
return function (err, results) { return function (err, results) {
assert.strictEqual(null, err, "expected " + expected + ", got error: " + err); assert.strictEqual(null, err, "expected " + expected + ", got error: " + err);

View File

@@ -73,7 +73,7 @@ describe("The 'multi' method", function () {
describe('pipeline limit', function () { describe('pipeline limit', function () {
it('do not exceed maximum string size', function (done) { it('do not exceed maximum string size', function (done) {
this.timeout(12000); // Windows tests on 0.10 are slow this.timeout(25000); // Windows tests are horribly slow
// Triggers a RangeError: Invalid string length if not handled properly // Triggers a RangeError: Invalid string length if not handled properly
client = redis.createClient(); client = redis.createClient();
var multi = client.multi(); var multi = client.multi();

View File

@@ -5,6 +5,11 @@ var config = require("./lib/config");
var helper = require('./helper'); var helper = require('./helper');
var redis = config.redis; var redis = config.redis;
if (process.platform === 'win32') {
// TODO: Fix redis process spawn on windows
return;
}
describe("rename commands", function () { describe("rename commands", function () {
before(function (done) { before(function (done) {
helper.stopRedis(function () { helper.stopRedis(function () {
@@ -18,6 +23,7 @@ describe("rename commands", function () {
var client = null; var client = null;
beforeEach(function(done) { beforeEach(function(done) {
if (helper.redisProcess().spawnFailed()) return done();
client = redis.createClient({ client = redis.createClient({
rename_commands: { rename_commands: {
set: '807081f5afa96845a02816a28b7258c3', set: '807081f5afa96845a02816a28b7258c3',
@@ -32,6 +38,7 @@ describe("rename commands", function () {
}); });
afterEach(function () { afterEach(function () {
if (helper.redisProcess().spawnFailed()) return;
client.end(true); client.end(true);
}); });
@@ -132,6 +139,7 @@ describe("rename commands", function () {
}); });
after(function (done) { after(function (done) {
if (helper.redisProcess().spawnFailed()) return done();
helper.stopRedis(function () { helper.stopRedis(function () {
helper.startRedis('./conf/redis.conf', done); helper.startRedis('./conf/redis.conf', done);
}); });

View File

@@ -32,26 +32,21 @@ describe("TLS connection tests", function () {
skip = true; skip = true;
console.warn('\nTravis does not support stunnel right now. Skipping tests.\nCheck: https://github.com/travis-ci/apt-package-whitelist/issues/403\n'); console.warn('\nTravis does not support stunnel right now. Skipping tests.\nCheck: https://github.com/travis-ci/apt-package-whitelist/issues/403\n');
} }
if (skip) { if (skip) return done();
done();
return;
}
helper.stopStunnel(function () { helper.stopStunnel(function () {
helper.startStunnel(done); helper.startStunnel(done);
}); });
}); });
after(function (done) { after(function (done) {
if (skip) { if (skip) return done();
done();
return;
}
helper.stopStunnel(done); helper.stopStunnel(done);
}); });
var client; var client;
afterEach(function () { afterEach(function () {
if (skip) return;
client.end(true); client.end(true);
}); });