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

down to one failing test on Windows, time to rebase

This commit is contained in:
Benjamin Coe
2015-09-12 18:22:32 -07:00
parent 65b26ed9aa
commit 77e8552374
3 changed files with 33 additions and 8 deletions

View File

@@ -23,7 +23,9 @@
"nyc": "^3.2.2", "nyc": "^3.2.2",
"optional-dev-dependency": "^1.0.1", "optional-dev-dependency": "^1.0.1",
"tcp-port-used": "^0.1.2", "tcp-port-used": "^0.1.2",
"uuid": "^2.0.1" "uuid": "^2.0.1",
"uuid": "^2.0.1",
"win-spawn": "^2.0.0"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -126,12 +126,12 @@ describe("The 'multi' method", function () {
client.multi([ client.multi([
["mget", "multifoo", "multibar", function (err, res) { ["mget", "multifoo", "multibar", function (err, res) {
assert.strictEqual(2, res.length); assert.strictEqual(2, res.length);
assert.strictEqual("0", res[0].toString()); assert.strictEqual(0, +res[0]);
assert.strictEqual("0", res[1].toString()); assert.strictEqual(0, +res[1]);
}], }],
["set", "foo2", helper.isError()], ["set", "foo2"],
["incr", "multifoo", helper.isNumber(1)], ["incr", "multifoo"],
["incr", "multibar", helper.isNumber(1)] ["incr", "multibar"]
]).exec(function (err, replies) { ]).exec(function (err, replies) {
if (helper.serverVersionAtLeast(client, [2, 6, 5])) { if (helper.serverVersionAtLeast(client, [2, 6, 5])) {
assert.notEqual(err, null); assert.notEqual(err, null);

View File

@@ -1,10 +1,10 @@
'use strict'; 'use strict';
// helper to start and stop the redis process. // helper to start and stop the redis process.
var cp = require('child_process');
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 spawnFailed = false; var spawnFailed = false;
var tcpPortUsed = require('tcp-port-used'); var tcpPortUsed = require('tcp-port-used');
@@ -32,7 +32,7 @@ module.exports = {
start: function (done, conf) { start: function (done, conf) {
// spawn redis with our testing configuration. // spawn redis with our testing configuration.
var confFile = conf || path.resolve(__dirname, '../conf/redis.conf'); var confFile = conf || path.resolve(__dirname, '../conf/redis.conf');
var rp = cp.spawn("redis-server", [confFile], {}); var rp = spawn("redis-server", [confFile], {});
// capture a failure booting redis, and give // capture a failure booting redis, and give
// the user running the test some directions. // the user running the test some directions.
@@ -66,3 +66,26 @@ module.exports = {
}); });
} }
}; };
// wait for redis to be listening in
// all three modes (ipv4, ipv6, socket).
function waitForRedis (available, cb) {
if (process.platform === 'win32') return cb();
var ipV4 = false;
var id = setInterval(function () {
tcpPortUsed.check(config.PORT, '127.0.0.1')
.then(function (_ipV4) {
ipV4 = _ipV4;
return tcpPortUsed.check(config.PORT, '::1');
})
.then(function (ipV6) {
if (ipV6 === available && ipV4 === available &&
fs.existsSync('/tmp/redis.sock') === available) {
clearInterval(id);
return cb();
}
});
}, 100);
}
>>>>>>> down to one failing test on Windows, time to rebase