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",
|
||||
"tcp-port-used": "^0.1.2",
|
||||
"uuid": "^2.0.1",
|
||||
"win-spawn": "^2.0.0"
|
||||
"cross-spawn": "^2.1.5"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -5,13 +5,9 @@ var config = require('./lib/config');
|
||||
var helper = require('./helper');
|
||||
var redis = config.redis;
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// TODO: Fix redis process spawn on windows
|
||||
return;
|
||||
}
|
||||
|
||||
describe('client authentication', function () {
|
||||
before(function (done) {
|
||||
this.timeout(25000);
|
||||
helper.stopRedis(function () {
|
||||
helper.startRedis('./conf/password.conf', done);
|
||||
});
|
||||
@ -286,6 +282,7 @@ describe('client authentication', function () {
|
||||
|
||||
after(function (done) {
|
||||
if (helper.redisProcess().spawnFailed()) return done();
|
||||
this.timeout(25000);
|
||||
helper.stopRedis(function () {
|
||||
helper.startRedis('./conf/redis.conf', done);
|
||||
});
|
||||
|
@ -8,16 +8,12 @@ var rp;
|
||||
var path = require('path');
|
||||
var redis = config.redis;
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// TODO: Fix redis process spawn on windows
|
||||
return;
|
||||
}
|
||||
|
||||
describe('master slave sync', function () {
|
||||
var master = null;
|
||||
var slave = null;
|
||||
|
||||
before(function (done) {
|
||||
this.timeout(25000);
|
||||
helper.stopRedis(function () {
|
||||
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) {
|
||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||
if (process.platform === 'win32') this.timeout(25000);
|
||||
|
||||
var port = 6381;
|
||||
var firstInfo;
|
||||
@ -85,6 +82,7 @@ describe('master slave sync', function () {
|
||||
|
||||
after(function (done) {
|
||||
if (helper.redisProcess().spawnFailed()) return done();
|
||||
this.timeout(25000);
|
||||
var end = helper.callFuncAfter(done, 3);
|
||||
rp.stop(end);
|
||||
slave.end(true);
|
||||
|
@ -15,19 +15,13 @@ function startRedis (conf, done, port) {
|
||||
}, path.resolve(__dirname, conf), port);
|
||||
}
|
||||
|
||||
// don't start redis every time we
|
||||
// include this helper file!
|
||||
if (!process.env.REDIS_TESTS_STARTED) {
|
||||
process.env.REDIS_TESTS_STARTED = true;
|
||||
before(function (done) {
|
||||
startRedis('./conf/redis.conf', done);
|
||||
});
|
||||
|
||||
before(function (done) {
|
||||
startRedis('./conf/redis.conf', done);
|
||||
});
|
||||
|
||||
after(function (done) {
|
||||
if (rp) rp.stop(done);
|
||||
});
|
||||
}
|
||||
after(function (done) {
|
||||
if (rp) rp.stop(done);
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
redisProcess: function () {
|
||||
|
@ -4,15 +4,13 @@
|
||||
var config = require('./config');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var spawn = require('win-spawn');
|
||||
var spawn = require('cross-spawn');
|
||||
var tcpPortUsed = require('tcp-port-used');
|
||||
var bluebird = require('bluebird');
|
||||
|
||||
// wait for redis to be listening in
|
||||
// all three modes (ipv4, ipv6, socket).
|
||||
function waitForRedis (available, cb, port) {
|
||||
if (process.platform === 'win32') return cb();
|
||||
|
||||
var time = Date.now();
|
||||
var running = false;
|
||||
var socket = '/tmp/redis.sock';
|
||||
@ -29,14 +27,14 @@ function waitForRedis (available, cb, port) {
|
||||
tcpPortUsed.check(port, '::1'),
|
||||
function (ipV4, ipV6) {
|
||||
if (ipV6 === available && ipV4 === available) {
|
||||
if (fs.existsSync(socket) === available) {
|
||||
if (fs.existsSync(socket) === available || process.platform === 'win32') {
|
||||
clearInterval(id);
|
||||
return cb();
|
||||
}
|
||||
// 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');
|
||||
}
|
||||
if (Date.now() - time > 6000) {
|
||||
if (Date.now() - time > 24000) {
|
||||
throw new Error('Redis could not start on port ' + (port || config.PORT) + '\n');
|
||||
}
|
||||
running = false;
|
||||
|
@ -5,13 +5,9 @@ var config = require('./lib/config');
|
||||
var helper = require('./helper');
|
||||
var redis = config.redis;
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// TODO: Fix redis process spawn on windows
|
||||
return;
|
||||
}
|
||||
|
||||
describe('rename commands', function () {
|
||||
before(function (done) {
|
||||
this.timeout(25000);
|
||||
helper.stopRedis(function () {
|
||||
helper.startRedis('./conf/rename.conf', done);
|
||||
});
|
||||
@ -140,6 +136,7 @@ describe('rename commands', function () {
|
||||
|
||||
after(function (done) {
|
||||
if (helper.redisProcess().spawnFailed()) return done();
|
||||
this.timeout(25000);
|
||||
helper.stopRedis(function () {
|
||||
helper.startRedis('./conf/redis.conf', done);
|
||||
});
|
||||
|
Reference in New Issue
Block a user