Skip to content

Commit 2fc54ec

Browse files
committed
Merge pull request #876 from NodeRedis/test-tweak
a couple tweaks to get the test suite running on my old MacBook
2 parents 25113e6 + b773119 commit 2fc54ec

File tree

2 files changed

+37
-38
lines changed

2 files changed

+37
-38
lines changed

test/helper.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ module.exports = {
159159
killConnection: function (client) {
160160
// Change the connection option to a non existing one and destroy the stream
161161
client.connectionOption = {
162-
port: 6370,
163-
host: '127.0.0.2',
162+
port: 65535,
163+
host: '127.0.0.1',
164164
family: 4
165165
};
166-
client.address = '127.0.0.2:6370';
166+
client.address = '127.0.0.1:65535';
167167
client.stream.destroy();
168168
}
169169
};

test/node_redis.spec.js

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ describe("The node_redis client", function () {
214214
var client = redis.createClient();
215215
client.quit(function() {
216216
client.get("foo", function(err, res) {
217-
assert.strictEqual(err.message, 'Redis connection gone from end event.');
217+
assert(err.message.indexOf('Redis connection gone') !== -1);
218218
assert.strictEqual(client.offline_queue.length, 0);
219219
done();
220220
});
@@ -355,42 +355,41 @@ describe("The node_redis client", function () {
355355
}
356356
});
357357
});
358+
});
358359

359-
describe('monitor', function () {
360-
it('monitors commands on all other redis clients', function (done) {
361-
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
362-
363-
var monitorClient = redis.createClient.apply(redis.createClient, args);
364-
var responses = [];
365-
366-
monitorClient.monitor(function (err, res) {
367-
client.mget("some", "keys", "foo", "bar");
368-
client.set("json", JSON.stringify({
369-
foo: "123",
370-
bar: "sdflkdfsjk",
371-
another: false
372-
}));
373-
});
374-
375-
monitorClient.on("monitor", function (time, args) {
376-
responses.push(args);
377-
if (responses.length === 2) {
378-
assert.strictEqual(5, responses[0].length);
379-
assert.strictEqual("mget", responses[0][0]);
380-
assert.strictEqual("some", responses[0][1]);
381-
assert.strictEqual("keys", responses[0][2]);
382-
assert.strictEqual("foo", responses[0][3]);
383-
assert.strictEqual("bar", responses[0][4]);
384-
assert.strictEqual(3, responses[1].length);
385-
assert.strictEqual("set", responses[1][0]);
386-
assert.strictEqual("json", responses[1][1]);
387-
assert.strictEqual('{"foo":"123","bar":"sdflkdfsjk","another":false}', responses[1][2]);
388-
monitorClient.quit(done);
389-
}
390-
});
360+
describe('monitor', function () {
361+
it('monitors commands on all other redis clients', function (done) {
362+
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
363+
364+
var monitorClient = redis.createClient.apply(redis.createClient, args);
365+
var responses = [];
366+
367+
monitorClient.monitor(function (err, res) {
368+
client.mget("some", "keys", "foo", "bar");
369+
client.set("json", JSON.stringify({
370+
foo: "123",
371+
bar: "sdflkdfsjk",
372+
another: false
373+
}));
374+
});
375+
376+
monitorClient.on("monitor", function (time, args) {
377+
responses.push(args);
378+
if (responses.length === 2) {
379+
assert.strictEqual(5, responses[0].length);
380+
assert.strictEqual("mget", responses[0][0]);
381+
assert.strictEqual("some", responses[0][1]);
382+
assert.strictEqual("keys", responses[0][2]);
383+
assert.strictEqual("foo", responses[0][3]);
384+
assert.strictEqual("bar", responses[0][4]);
385+
assert.strictEqual(3, responses[1].length);
386+
assert.strictEqual("set", responses[1][0]);
387+
assert.strictEqual("json", responses[1][1]);
388+
assert.strictEqual('{"foo":"123","bar":"sdflkdfsjk","another":false}', responses[1][2]);
389+
monitorClient.quit(done);
390+
}
391391
});
392392
});
393-
394393
});
395394

396395
describe('idle', function () {
@@ -619,7 +618,7 @@ describe("The node_redis client", function () {
619618
client.set('baz', 13);
620619
client.set('foo', 'bar', function(err, result) {
621620
assert(i, 3);
622-
assert('Redis connection gone from error event', err.message);
621+
assert(err);
623622
assert.strictEqual(client.offline_queue.length, 0);
624623
});
625624
});

0 commit comments

Comments
 (0)