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

Fix some tests

This commit is contained in:
Ruben Bridgewater
2015-10-10 19:37:42 +02:00
parent 6d8daef599
commit 90033bdd00
3 changed files with 7 additions and 5 deletions

View File

@@ -3,15 +3,15 @@
// as soon as there are no outstanding commands. // as soon as there are no outstanding commands.
'use strict'; 'use strict';
var redis = require("../../"); var redis = require("../../index");
var HOST = process.argv[2] || '127.0.0.1'; var HOST = process.argv[2] || '127.0.0.1';
var PORT = process.argv[3]; var PORT = process.argv[3];
var args = PORT ? [PORT, HOST] : [HOST]; var args = PORT ? [PORT, HOST] : [HOST];
var c = redis.createClient.apply(redis, args); var c = redis.createClient.apply(redis, args);
c.unref();
c.info(function (err, reply) { c.info(function (err, reply) {
if (err) process.exit(-1); if (err) process.exit(-1);
if (!reply.length) process.exit(-1); if (!reply.length) process.exit(-1);
process.stdout.write(reply.length.toString()); process.stdout.write(reply.length.toString());
}); });
c.unref();

View File

@@ -416,12 +416,14 @@ describe("The node_redis client", function () {
describe('unref', function () { describe('unref', function () {
it('exits subprocess as soon as final command is processed', function (done) { it('exits subprocess as soon as final command is processed', function (done) {
this.timeout(12000);
var args = config.HOST[ip] ? [config.HOST[ip], config.PORT] : [ip]; var args = config.HOST[ip] ? [config.HOST[ip], config.PORT] : [ip];
var external = fork("./test/lib/unref.js", args); var external = fork("./test/lib/unref.js", args);
var id = setTimeout(function () { var id = setTimeout(function () {
external.kill(); external.kill();
return done(Error('unref subprocess timed out')); return done(Error('unref subprocess timed out'));
}, 5000); }, 8000);
external.on("close", function (code) { external.on("close", function (code) {
clearTimeout(id); clearTimeout(id);
@@ -555,7 +557,7 @@ describe("The node_redis client", function () {
} else { } else {
client.end(); client.end();
var lasted = new Date().getTime() - time; var lasted = new Date().getTime() - time;
assert.ok(lasted < 50); assert.ok(lasted < 100);
return done(); return done();
} }
}); });

View File

@@ -147,7 +147,7 @@ describe("publish/subscribe", function () {
}); });
}); });
it('handles SUB_UNSUB_MSG_SUB', function (done) { it('handles SUB_UNSUB_MSG_SUB 2', function (done) {
helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]); helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]);
sub.psubscribe('abc*'); sub.psubscribe('abc*');