1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

Do not run all tests with every single connection (if one connection works, the others are going to be fine too)

This commit is contained in:
Ruben Bridgewater
2015-09-10 18:06:50 +02:00
parent 1e0421ac3b
commit 0b8705abe9
4 changed files with 27 additions and 21 deletions

View File

@@ -12,10 +12,11 @@ describe("client authentication", function () {
});
});
helper.allTests(function(parser, ip, args) {
helper.allTests({
allConnections: true
}, function(parser, ip, args) {
describe("using " + parser + " and " + ip, function () {
var args = config.configureClient(parser, ip);
var auth = 'porkchopsandwiches';
var client = null;

View File

@@ -13,7 +13,6 @@ describe("The 'hgetall' method", function () {
var client;
describe('regular client', function () {
var args = config.configureClient(parser, ip);
beforeEach(function (done) {
client = redis.createClient.apply(redis.createClient, args);

View File

@@ -108,22 +108,27 @@ module.exports = {
}
return true;
},
allTests: function (cb) {
[undefined].forEach(function (options) { // add buffer option at some point
describe(options && options.return_buffers ? "returning buffers" : "returning strings", function () {
allTests: function (options, cb) {
if (!cb) {
cb = options;
options = {};
}
// TODO: Test all different option cases at some point (e.g. buffers)
// [undefined, { return_buffers: true }].forEach(function (config_options) {
// describe(config_options && config_options.return_buffers ? "returning buffers" : "returning strings", function () {
// });
// });
var parsers = ['javascript'];
var protocols = ['IPv4'];
if (process.platform !== 'win32') {
parsers.push('hiredis');
protocols.push('IPv6');
protocols.push('IPv6', '/tmp/redis.sock');
}
parsers.forEach(function (parser) {
if (process.platform !== 'win32') cb(parser, "/tmp/redis.sock", config.configureClient(parser, "/tmp/redis.sock", options));
protocols.forEach(function (ip) {
cb(parser, ip, config.configureClient(parser, ip, options));
});
});
protocols.forEach(function (ip, i) {
if (i === 0 || options.allConnections) {
cb(parser, ip, config.configureClient(parser, ip));
}
});
});
},

View File

@@ -8,7 +8,9 @@ var redis = config.redis;
describe("The node_redis client", function () {
helper.allTests(function(parser, ip, args) {
helper.allTests({
allConnections: true
}, function(parser, ip, args) {
if (args[2]) { // skip if options are undefined
describe("testing parser existence", function () {
@@ -624,7 +626,6 @@ describe("The node_redis client", function () {
describe('defaults to true', function () {
var client;
var args = config.configureClient(parser, ip);
it("fires client.on('ready')", function (done) {
client = redis.createClient.apply(redis.createClient, args);
@@ -703,7 +704,7 @@ describe("The node_redis client", function () {
if (err) return done(err);
});
return setTimeout(function(){
return setTimeout(function() {
assert.strictEqual(client.offline_queue.length, 1);
return done();
}, 25);