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

Add test for auth_pass option submitted by hpeinar

This commit is contained in:
Bryce Baril
2013-07-24 08:21:28 -07:00
parent 882556e32d
commit 8f71003009
3 changed files with 22 additions and 1 deletions

View File

@@ -1,6 +1,9 @@
Changelog Changelog
========= =========
## v0.8.5 - (pending release)
* Add `auth_pass` option to connect and immediately authenticate (Henrik Peinar)
## v0.8.4 - June 24, 2013 ## v0.8.4 - June 24, 2013
Many contributed features and fixes, including: Many contributed features and fixes, including:
* Ignore password set if not needed. (jbergknoff) * Ignore password set if not needed. (jbergknoff)

View File

@@ -67,7 +67,7 @@ function RedisClient(stream, options) {
this.closing = false; this.closing = false;
this.server_info = {}; this.server_info = {};
this.auth_pass = null; this.auth_pass = null;
if(options.auth_pass !== undefined) { if (options.auth_pass !== undefined) {
this.auth_pass = options.auth_pass; this.auth_pass = options.auth_pass;
} }
this.parser_module = null; this.parser_module = null;

18
test.js
View File

@@ -1962,6 +1962,24 @@ tests.auth = function () {
}); });
}; };
tests.auth2 = function () {
var name = "AUTH2", client4, ready_count = 0;
client4 = redis.createClient(9006, "filefish.redistogo.com", {auth_pass: "664b1b6aaf134e1ec281945a8de702a9"});
// test auth, then kill the connection so it'll auto-reconnect and auto-re-auth
client4.on("ready", function () {
ready_count++;
if (ready_count === 1) {
client4.stream.destroy();
} else {
client4.quit(function (err, res) {
next(name);
});
}
});
};
tests.reconnectRetryMaxDelay = function() { tests.reconnectRetryMaxDelay = function() {
var time = new Date().getTime(), var time = new Date().getTime(),
name = 'reconnectRetryMaxDelay', name = 'reconnectRetryMaxDelay',