Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Better checking for a redis instance before starting the test suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
tizzo committed Aug 13, 2014
1 parent f2983b0 commit e7f2e05
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ var testServers = [];

describe('Integration', function(){
before(function(done) {
if (app.redisClient.connected == false) {
var checkRedisConnection = function(cb) {
if (app.redisClient.connected === true) {
return cb();
}
// Sometimes it takes a second to connect to redis...
setTimeout(function() {
if (app.redisClient.connected == false) {
throw new Error('Tests require a redis instance.');
process.exit(1);
if (app.redisClient.connected === false) {
done(new Error('Tests require a redis instance.'));
}
}, 250);
}
};
app.logger.transports = [];
app.passport.unuse('google');
app.passport.use(new MockAuth.MockStrategy());
Expand Down Expand Up @@ -55,10 +57,11 @@ describe('Integration', function(){
cb(error);
});
};
async.waterfall([app.configure.bind(app, null), findPorts, startTestServer1, startTestServer2, app.start], done);
async.waterfall([checkRedisConnection, app.configure.bind(app, null), findPorts, startTestServer1, startTestServer2, app.start], done);
});
after(function() {
app.stop();
var i = null;
for (i in testServers) {
testServers[i].close();
}
Expand Down

0 comments on commit e7f2e05

Please sign in to comment.