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

prep for getting tests to work on appveyor

This commit is contained in:
Benjamin Coe
2015-09-11 23:23:34 -07:00
parent 06121a65c4
commit b4da975785
4 changed files with 30 additions and 8 deletions

View File

@ -24,6 +24,8 @@ describe("client authentication", function () {
});
it("allows auth to be provided with 'auth' method", function (done) {
abortOnSpawnFailure(done);
client = redis.createClient.apply(redis.createClient, args);
client.auth(auth, function (err, res) {
assert.strictEqual(null, err);
@ -33,6 +35,8 @@ describe("client authentication", function () {
});
it("raises error when auth is bad", function (done) {
abortOnSpawnFailure(done);
client = redis.createClient.apply(redis.createClient, args);
client.once('error', function (error) {
@ -45,6 +49,8 @@ describe("client authentication", function () {
if (ip === 'IPv4') {
it('allows auth to be provided as part of redis url', function (done) {
abortOnSpawnFailure(done);
client = redis.createClient('redis://foo:' + auth + '@' + config.HOST[ip] + ':' + config.PORT);
client.on("ready", function () {
return done();
@ -53,6 +59,8 @@ describe("client authentication", function () {
}
it('allows auth to be provided as config option for client', function (done) {
abortOnSpawnFailure(done);
var args = config.configureClient(parser, ip, {
auth_pass: auth
});
@ -63,6 +71,8 @@ describe("client authentication", function () {
});
it('reconnects with appropriate authentication', function (done) {
abortOnSpawnFailure(done);
var readyCount = 0;
client = redis.createClient.apply(redis.createClient, args);
client.auth(auth);
@ -83,4 +93,13 @@ describe("client authentication", function () {
helper.startRedis('./conf/redis.conf', done);
});
});
// if we fail to spawn Redis (spawning Redis directly is
// not possible in some CI environments) skip the auth tests.
function abortOnSpawnFailure (done) {
if (helper.redisProcess().spawnFailed()) {
console.warn('skipped authentication test')
return done();
}
}
});