diff --git a/test/helper.js b/test/helper.js index 5f4f791..d007676 100644 --- a/test/helper.js +++ b/test/helper.js @@ -159,11 +159,11 @@ module.exports = { killConnection: function (client) { // Change the connection option to a non existing one and destroy the stream client.connectionOption = { - port: 6370, - host: '127.0.0.2', + port: 65535, + host: '127.0.0.1', family: 4 }; - client.address = '127.0.0.2:6370'; + client.address = '127.0.0.1:65535'; client.stream.destroy(); } }; diff --git a/test/node_redis.spec.js b/test/node_redis.spec.js index f45480e..cd66596 100644 --- a/test/node_redis.spec.js +++ b/test/node_redis.spec.js @@ -214,7 +214,7 @@ describe("The node_redis client", function () { var client = redis.createClient(); client.quit(function() { client.get("foo", function(err, res) { - assert.strictEqual(err.message, 'Redis connection gone from end event.'); + assert(err.message.indexOf('Redis connection gone') !== -1); assert.strictEqual(client.offline_queue.length, 0); done(); }); @@ -355,42 +355,41 @@ describe("The node_redis client", function () { } }); }); + }); - describe('monitor', function () { - it('monitors commands on all other redis clients', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 0]); - - var monitorClient = redis.createClient.apply(redis.createClient, args); - var responses = []; - - monitorClient.monitor(function (err, res) { - client.mget("some", "keys", "foo", "bar"); - client.set("json", JSON.stringify({ - foo: "123", - bar: "sdflkdfsjk", - another: false - })); - }); - - monitorClient.on("monitor", function (time, args) { - responses.push(args); - if (responses.length === 2) { - assert.strictEqual(5, responses[0].length); - assert.strictEqual("mget", responses[0][0]); - assert.strictEqual("some", responses[0][1]); - assert.strictEqual("keys", responses[0][2]); - assert.strictEqual("foo", responses[0][3]); - assert.strictEqual("bar", responses[0][4]); - assert.strictEqual(3, responses[1].length); - assert.strictEqual("set", responses[1][0]); - assert.strictEqual("json", responses[1][1]); - assert.strictEqual('{"foo":"123","bar":"sdflkdfsjk","another":false}', responses[1][2]); - monitorClient.quit(done); - } - }); + describe('monitor', function () { + it('monitors commands on all other redis clients', function (done) { + helper.serverVersionAtLeast.call(this, client, [2, 6, 0]); + + var monitorClient = redis.createClient.apply(redis.createClient, args); + var responses = []; + + monitorClient.monitor(function (err, res) { + client.mget("some", "keys", "foo", "bar"); + client.set("json", JSON.stringify({ + foo: "123", + bar: "sdflkdfsjk", + another: false + })); + }); + + monitorClient.on("monitor", function (time, args) { + responses.push(args); + if (responses.length === 2) { + assert.strictEqual(5, responses[0].length); + assert.strictEqual("mget", responses[0][0]); + assert.strictEqual("some", responses[0][1]); + assert.strictEqual("keys", responses[0][2]); + assert.strictEqual("foo", responses[0][3]); + assert.strictEqual("bar", responses[0][4]); + assert.strictEqual(3, responses[1].length); + assert.strictEqual("set", responses[1][0]); + assert.strictEqual("json", responses[1][1]); + assert.strictEqual('{"foo":"123","bar":"sdflkdfsjk","another":false}', responses[1][2]); + monitorClient.quit(done); + } }); }); - }); describe('idle', function () { @@ -619,7 +618,7 @@ describe("The node_redis client", function () { client.set('baz', 13); client.set('foo', 'bar', function(err, result) { assert(i, 3); - assert('Redis connection gone from error event', err.message); + assert(err); assert.strictEqual(client.offline_queue.length, 0); }); });