You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Test windows fixes
Replace win-spawn with cross-spawn
This commit is contained in:
@ -43,7 +43,7 @@
|
|||||||
"optional-dev-dependency": "^1.1.0",
|
"optional-dev-dependency": "^1.1.0",
|
||||||
"tcp-port-used": "^0.1.2",
|
"tcp-port-used": "^0.1.2",
|
||||||
"uuid": "^2.0.1",
|
"uuid": "^2.0.1",
|
||||||
"win-spawn": "^2.0.0"
|
"cross-spawn": "^2.1.5"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -5,13 +5,9 @@ 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) {
|
||||||
|
this.timeout(25000);
|
||||||
helper.stopRedis(function () {
|
helper.stopRedis(function () {
|
||||||
helper.startRedis('./conf/password.conf', done);
|
helper.startRedis('./conf/password.conf', done);
|
||||||
});
|
});
|
||||||
@ -286,6 +282,7 @@ describe('client authentication', function () {
|
|||||||
|
|
||||||
after(function (done) {
|
after(function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) return done();
|
if (helper.redisProcess().spawnFailed()) return done();
|
||||||
|
this.timeout(25000);
|
||||||
helper.stopRedis(function () {
|
helper.stopRedis(function () {
|
||||||
helper.startRedis('./conf/redis.conf', done);
|
helper.startRedis('./conf/redis.conf', done);
|
||||||
});
|
});
|
||||||
|
@ -8,16 +8,12 @@ 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;
|
||||||
|
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
|
this.timeout(25000);
|
||||||
helper.stopRedis(function () {
|
helper.stopRedis(function () {
|
||||||
helper.startRedis('./conf/password.conf', done);
|
helper.startRedis('./conf/password.conf', done);
|
||||||
});
|
});
|
||||||
@ -40,6 +36,7 @@ describe('master slave sync', function () {
|
|||||||
|
|
||||||
it('sync process and no master should delay ready being emitted for slaves', function (done) {
|
it('sync process and no master should delay ready being emitted for slaves', function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||||
|
if (process.platform === 'win32') this.timeout(25000);
|
||||||
|
|
||||||
var port = 6381;
|
var port = 6381;
|
||||||
var firstInfo;
|
var firstInfo;
|
||||||
@ -85,6 +82,7 @@ describe('master slave sync', function () {
|
|||||||
|
|
||||||
after(function (done) {
|
after(function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) return done();
|
if (helper.redisProcess().spawnFailed()) return done();
|
||||||
|
this.timeout(25000);
|
||||||
var end = helper.callFuncAfter(done, 3);
|
var end = helper.callFuncAfter(done, 3);
|
||||||
rp.stop(end);
|
rp.stop(end);
|
||||||
slave.end(true);
|
slave.end(true);
|
||||||
|
@ -15,19 +15,13 @@ function startRedis (conf, done, port) {
|
|||||||
}, path.resolve(__dirname, conf), port);
|
}, path.resolve(__dirname, conf), port);
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't start redis every time we
|
before(function (done) {
|
||||||
// include this helper file!
|
startRedis('./conf/redis.conf', done);
|
||||||
if (!process.env.REDIS_TESTS_STARTED) {
|
});
|
||||||
process.env.REDIS_TESTS_STARTED = true;
|
|
||||||
|
|
||||||
before(function (done) {
|
after(function (done) {
|
||||||
startRedis('./conf/redis.conf', done);
|
if (rp) rp.stop(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function (done) {
|
|
||||||
if (rp) rp.stop(done);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
redisProcess: function () {
|
redisProcess: function () {
|
||||||
|
@ -4,15 +4,13 @@
|
|||||||
var config = require('./config');
|
var config = require('./config');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var spawn = require('win-spawn');
|
var spawn = require('cross-spawn');
|
||||||
var tcpPortUsed = require('tcp-port-used');
|
var tcpPortUsed = require('tcp-port-used');
|
||||||
var bluebird = require('bluebird');
|
var bluebird = require('bluebird');
|
||||||
|
|
||||||
// wait for redis to be listening in
|
// wait for redis to be listening in
|
||||||
// all three modes (ipv4, ipv6, socket).
|
// all three modes (ipv4, ipv6, socket).
|
||||||
function waitForRedis (available, cb, port) {
|
function waitForRedis (available, cb, port) {
|
||||||
if (process.platform === 'win32') return cb();
|
|
||||||
|
|
||||||
var time = Date.now();
|
var time = Date.now();
|
||||||
var running = false;
|
var running = false;
|
||||||
var socket = '/tmp/redis.sock';
|
var socket = '/tmp/redis.sock';
|
||||||
@ -29,14 +27,14 @@ function waitForRedis (available, cb, port) {
|
|||||||
tcpPortUsed.check(port, '::1'),
|
tcpPortUsed.check(port, '::1'),
|
||||||
function (ipV4, ipV6) {
|
function (ipV4, ipV6) {
|
||||||
if (ipV6 === available && ipV4 === available) {
|
if (ipV6 === available && ipV4 === available) {
|
||||||
if (fs.existsSync(socket) === available) {
|
if (fs.existsSync(socket) === available || process.platform === 'win32') {
|
||||||
clearInterval(id);
|
clearInterval(id);
|
||||||
return cb();
|
return cb();
|
||||||
}
|
}
|
||||||
// The same message applies for can't stop but we ignore that case
|
// The same message applies for can't stop but we ignore that case
|
||||||
throw new Error('Port ' + port + ' is already in use. Tests can\'t start.\n');
|
throw new Error('Port ' + port + ' is already in use. Tests can\'t start.\n');
|
||||||
}
|
}
|
||||||
if (Date.now() - time > 6000) {
|
if (Date.now() - time > 24000) {
|
||||||
throw new Error('Redis could not start on port ' + (port || config.PORT) + '\n');
|
throw new Error('Redis could not start on port ' + (port || config.PORT) + '\n');
|
||||||
}
|
}
|
||||||
running = false;
|
running = false;
|
||||||
|
@ -5,13 +5,9 @@ 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) {
|
||||||
|
this.timeout(25000);
|
||||||
helper.stopRedis(function () {
|
helper.stopRedis(function () {
|
||||||
helper.startRedis('./conf/rename.conf', done);
|
helper.startRedis('./conf/rename.conf', done);
|
||||||
});
|
});
|
||||||
@ -140,6 +136,7 @@ describe('rename commands', function () {
|
|||||||
|
|
||||||
after(function (done) {
|
after(function (done) {
|
||||||
if (helper.redisProcess().spawnFailed()) return done();
|
if (helper.redisProcess().spawnFailed()) return done();
|
||||||
|
this.timeout(25000);
|
||||||
helper.stopRedis(function () {
|
helper.stopRedis(function () {
|
||||||
helper.startRedis('./conf/redis.conf', done);
|
helper.startRedis('./conf/redis.conf', done);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user