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 () { describe("using " + parser + " and " + ip, function () {
var args = config.configureClient(parser, ip);
var auth = 'porkchopsandwiches'; var auth = 'porkchopsandwiches';
var client = null; var client = null;

View File

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

View File

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

View File

@@ -8,7 +8,9 @@ var redis = config.redis;
describe("The node_redis client", function () { 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 if (args[2]) { // skip if options are undefined
describe("testing parser existence", function () { describe("testing parser existence", function () {
@@ -624,7 +626,6 @@ describe("The node_redis client", function () {
describe('defaults to true', function () { describe('defaults to true', function () {
var client; var client;
var args = config.configureClient(parser, ip);
it("fires client.on('ready')", function (done) { it("fires client.on('ready')", function (done) {
client = redis.createClient.apply(redis.createClient, args); client = redis.createClient.apply(redis.createClient, args);