Skip to content

Commit 0207163

Browse files
author
Ruben Bridgewater
committed
Remove support of redis 2.4
All tests require at least redis 2.6 from now on. Anyone who wants to run the tests should be able to install a newer version.
1 parent 36429d1 commit 0207163

File tree

7 files changed

+6
-77
lines changed

7 files changed

+6
-77
lines changed

test/batch.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,6 @@ describe("The 'batch' method", function () {
328328
});
329329

330330
it("should work without any callback", function (done) {
331-
helper.serverVersionAtLeast.call(this, client, [2, 6, 5]);
332-
333331
var batch = client.batch();
334332
batch.set("baz", "binary");
335333
batch.set("foo", "bar");

test/commands/client.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ describe("The 'client' method", function () {
6868
});
6969

7070
it('sets the name', function (done) {
71-
helper.serverVersionAtLeast.call(this, client, [2, 6, 9]);
72-
7371
// The querys are auto pipelined and the response is a response to all querys of one client
7472
// per chunk. So the execution order is only garanteed on each client
7573
var end = helper.callFuncAfter(done, 2);

test/commands/eval.spec.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,26 @@ describe("The 'eval' method", function () {
2626
});
2727

2828
it('converts a float to an integer when evaluated', function (done) {
29-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
3029
client.eval("return 100.5", 0, helper.isNumber(100, done));
3130
});
3231

3332
it('returns a string', function (done) {
34-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
3533
client.eval("return 'hello world'", 0, helper.isString('hello world', done));
3634
});
3735

3836
it('converts boolean true to integer 1', function (done) {
39-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
4037
client.eval("return true", 0, helper.isNumber(1, done));
4138
});
4239

4340
it('converts boolean false to null', function (done) {
44-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
4541
client.eval("return false", 0, helper.isNull(done));
4642
});
4743

4844
it('converts lua status code to string representation', function (done) {
49-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
5045
client.eval("return {ok='fine'}", 0, helper.isString('fine', done));
5146
});
5247

5348
it('converts lua error to an error response', function (done) {
54-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
5549
client.eval("return {err='this is an error'}", 0, function(err) {
5650
assert(err.code === undefined);
5751
helper.isError()(err);
@@ -60,7 +54,6 @@ describe("The 'eval' method", function () {
6054
});
6155

6256
it('represents a lua table appropritely', function (done) {
63-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
6457
client.eval("return {1,2,3,'ciao',{1,2}}", 0, function (err, res) {
6558
assert.strictEqual(5, res.length);
6659
assert.strictEqual(1, res[0]);
@@ -75,7 +68,6 @@ describe("The 'eval' method", function () {
7568
});
7669

7770
it('populates keys and argv correctly', function (done) {
78-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
7971
client.eval("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d", function (err, res) {
8072
assert.strictEqual(4, res.length);
8173
assert.strictEqual("a", res[0]);
@@ -87,7 +79,6 @@ describe("The 'eval' method", function () {
8779
});
8880

8981
it('allows arguments to be provided in array rather than as multiple parameters', function (done) {
90-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
9182
client.eval(["return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d"], function (err, res) {
9283
assert.strictEqual(4, res.length);
9384
assert.strictEqual("a", res[0]);
@@ -99,7 +90,6 @@ describe("The 'eval' method", function () {
9990
});
10091

10192
it('allows a script to be executed that accesses the redis API without callback', function (done) {
102-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
10393
client.eval(source, 0);
10494
client.get('sha', helper.isString('test', done));
10595
});
@@ -108,24 +98,20 @@ describe("The 'eval' method", function () {
10898
var sha = crypto.createHash('sha1').update(source).digest('hex');
10999

110100
it('allows a script to be executed that accesses the redis API', function (done) {
111-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
112101
client.eval(source, 0, helper.isString('OK'));
113102
client.get('sha', helper.isString('test', done));
114103
});
115104

116105
it('can execute a script if the SHA exists', function (done) {
117-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
118106
client.evalsha(sha, 0, helper.isString('OK'));
119107
client.get('sha', helper.isString('test', done));
120108
});
121109

122110
it('returns an error if SHA does not exist', function (done) {
123-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
124111
client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0, helper.isError(done));
125112
});
126113

127114
it('emit an error if SHA does not exist without any callback', function (done) {
128-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
129115
client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0);
130116
client.on('error', function(err) {
131117
assert.equal(err.code, 'NOSCRIPT');
@@ -144,7 +130,6 @@ describe("The 'eval' method", function () {
144130
});
145131

146132
it('allows a key to be incremented, and performs appropriate conversion from LUA type', function (done) {
147-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
148133
client.set("incr key", 0, function (err, reply) {
149134
if (err) return done(err);
150135
client.eval("local foo = redis.call('incr','incr key')\n" + "return {type(foo),foo}", 0, function (err, res) {
@@ -157,7 +142,6 @@ describe("The 'eval' method", function () {
157142
});
158143

159144
it('allows a bulk operation to be performed, and performs appropriate conversion from LUA type', function (done) {
160-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
161145
client.set("bulk reply key", "bulk reply value", function (err, res) {
162146
client.eval("local foo = redis.call('get','bulk reply key'); return {type(foo),foo}", 0, function (err, res) {
163147
assert.strictEqual(2, res.length);
@@ -169,7 +153,6 @@ describe("The 'eval' method", function () {
169153
});
170154

171155
it('allows a multi mulk operation to be performed, with the appropriate type conversion', function (done) {
172-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
173156
client.multi()
174157
.del("mylist")
175158
.rpush("mylist", "a")
@@ -190,7 +173,6 @@ describe("The 'eval' method", function () {
190173
});
191174

192175
it('returns an appropriate representation of Lua status reply', function (done) {
193-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
194176
client.eval("local foo = redis.call('set','mykey','myval'); return {type(foo),foo['ok']}", 0, function (err, res) {
195177
assert.strictEqual(2, res.length);
196178
assert.strictEqual("table", res[0]);
@@ -200,7 +182,6 @@ describe("The 'eval' method", function () {
200182
});
201183

202184
it('returns an appropriate representation of a Lua error reply', function (done) {
203-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
204185
client.set("error reply key", "error reply value", function (err, res) {
205186
if (err) return done(err);
206187
client.eval("local foo = redis.pcall('incr','error reply key'); return {type(foo),foo['err']}", 0, function (err, res) {
@@ -213,7 +194,6 @@ describe("The 'eval' method", function () {
213194
});
214195

215196
it('returns an appropriate representation of a Lua nil reply', function (done) {
216-
helper.serverVersionAtLeast.call(this, client, [2, 5, 0]);
217197
client.del("nil reply key", function (err, res) {
218198
if (err) return done(err);
219199
client.eval("local foo = redis.call('get','nil reply key'); return {type(foo),foo == false}", 0, function (err, res) {

test/commands/script.spec.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,24 @@ describe("The 'script' method", function () {
2727
});
2828

2929
it("loads script with client.script('load')", function (done) {
30-
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
3130
client.script("load", command, function(err, result) {
3231
assert.strictEqual(result, commandSha);
3332
return done();
3433
});
3534
});
3635

3736
it('allows a loaded script to be evaluated', function (done) {
38-
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
3937
client.evalsha(commandSha, 0, helper.isString('99', done));
4038
});
4139

4240
it('allows a script to be loaded as part of a chained transaction', function (done) {
43-
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
4441
client.multi().script("load", command).exec(function(err, result) {
4542
assert.strictEqual(result[0], commandSha);
4643
return done();
4744
});
4845
});
4946

5047
it("allows a script to be loaded using a transaction's array syntax", function (done) {
51-
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
5248
client.multi([['script', 'load', command]]).exec(function(err, result) {
5349
assert.strictEqual(result[0], commandSha);
5450
return done();

test/multi.spec.js

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -251,25 +251,18 @@ describe("The 'multi' method", function () {
251251

252252
it('roles back a transaction when one command in a sequence of commands fails', function (done) {
253253
var multi1, multi2;
254-
var expected = helper.serverVersionAtLeast(client, [2, 6, 5]) ? helper.isError() : function () {};
255-
256254
// Provoke an error at queue time
257255
multi1 = client.MULTI();
258256
multi1.mset("multifoo", "10", "multibar", "20", helper.isString("OK"));
259257

260-
multi1.set("foo2", expected);
258+
multi1.set("foo2", helper.isError());
261259
multi1.incr("multifoo");
262260
multi1.incr("multibar");
263261
multi1.exec(function () {
264262
// Redis 2.6.5+ will abort transactions with errors
265263
// see: http://redis.io/topics/transactions
266-
var multibar_expected = 22;
267-
var multifoo_expected = 12;
268-
if (helper.serverVersionAtLeast(client, [2, 6, 5])) {
269-
multibar_expected = 1;
270-
multifoo_expected = 1;
271-
}
272-
264+
var multibar_expected = 1;
265+
var multifoo_expected = 1;
273266
// Confirm that the previous command, while containing an error, still worked.
274267
multi2 = client.multi();
275268
multi2.incr("multibar", helper.isNumber(multibar_expected));
@@ -283,31 +276,19 @@ describe("The 'multi' method", function () {
283276
});
284277

285278
it('roles back a transaction when one command in an array of commands fails', function (done) {
286-
var expected = helper.serverVersionAtLeast(client, [2, 6, 5]) ? helper.isError() : function () {};
287-
288279
// test nested multi-bulk replies
289280
client.multi([
290281
["mget", "multifoo", "multibar", function (err, res) {
291282
assert.strictEqual(2, res.length);
292283
assert.strictEqual(0, +res[0]);
293284
assert.strictEqual(0, +res[1]);
294285
}],
295-
["set", "foo2", expected],
286+
["set", "foo2", helper.isError()],
296287
["incr", "multifoo"],
297288
["incr", "multibar"]
298289
]).exec(function (err, replies) {
299-
if (helper.serverVersionAtLeast(client, [2, 6, 5])) {
300-
assert.notEqual(err, null);
301-
assert.equal(replies, undefined);
302-
} else {
303-
assert.strictEqual(2, replies[0].length);
304-
assert.strictEqual(null, replies[0][0]);
305-
assert.strictEqual(null, replies[0][1]);
306-
307-
assert.strictEqual("1", replies[1].toString());
308-
assert.strictEqual("1", replies[2].toString());
309-
}
310-
290+
assert.notEqual(err, null);
291+
assert.equal(replies, undefined);
311292
return done();
312293
});
313294
});
@@ -537,8 +518,6 @@ describe("The 'multi' method", function () {
537518
});
538519

539520
it("emits an error if no callback has been provided and execabort error occured", function (done) {
540-
helper.serverVersionAtLeast.call(this, client, [2, 6, 5]);
541-
542521
var multi = client.multi();
543522
multi.config("bar");
544523
multi.set("foo");
@@ -551,8 +530,6 @@ describe("The 'multi' method", function () {
551530
});
552531

553532
it("should work without any callback", function (done) {
554-
helper.serverVersionAtLeast.call(this, client, [2, 6, 5]);
555-
556533
var multi = client.multi();
557534
multi.set("baz", "binary");
558535
multi.set("foo", "bar");
@@ -583,8 +560,6 @@ describe("The 'multi' method", function () {
583560
});
584561

585562
it("should use transaction with exec_atomic and more than one command used", function (done) {
586-
helper.serverVersionAtLeast.call(this, client, [2, 6, 5]);
587-
588563
var multi = client.multi();
589564
var test = false;
590565
multi.exec_batch = function () {
@@ -597,8 +572,6 @@ describe("The 'multi' method", function () {
597572
});
598573

599574
it("do not mutate arguments in the multi constructor", function (done) {
600-
helper.serverVersionAtLeast.call(this, client, [2, 6, 5]);
601-
602575
var input = [['set', 'foo', 'bar'], ['get', 'foo']];
603576
client.multi(input).exec(function (err, res) {
604577
assert.strictEqual(input.length, 2);
@@ -609,8 +582,6 @@ describe("The 'multi' method", function () {
609582
});
610583

611584
it("works properly after a reconnect. issue #897", function (done) {
612-
helper.serverVersionAtLeast.call(this, client, [2, 6, 5]);
613-
614585
client.stream.destroy();
615586
client.on('error', function (err) {
616587
assert.strictEqual(err.code, 'ECONNREFUSED');
@@ -625,8 +596,6 @@ describe("The 'multi' method", function () {
625596
});
626597

627598
it("emits error once if reconnecting after multi has been executed but not yet returned without callback", function (done) {
628-
helper.serverVersionAtLeast.call(this, client, [2, 6, 5]);
629-
630599
client.on('error', function(err) {
631600
assert.strictEqual(err.code, 'UNCERTAIN_STATE');
632601
done();

test/node_redis.spec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ describe("The node_redis client", function () {
345345

346346
describe('monitor', function () {
347347
it('monitors commands on all other redis clients', function (done) {
348-
helper.serverVersionAtLeast.call(this, client, [2, 6, 0]);
349-
350348
var monitorClient = redis.createClient.apply(redis.createClient, args);
351349
var responses = [];
352350

test/pubsub.spec.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ describe("publish/subscribe", function () {
104104
});
105105

106106
it('receives messages if subscribe is called after unsubscribe', function (done) {
107-
helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]);
108-
109107
var end = helper.callFuncAfter(done, 2);
110108
sub.once("subscribe", function (chnl, count) {
111109
pub.publish(channel, message, function (err, res) {
@@ -126,8 +124,6 @@ describe("publish/subscribe", function () {
126124
});
127125

128126
it('handles SUB_UNSUB_MSG_SUB', function (done) {
129-
helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]);
130-
131127
sub.subscribe('chan8');
132128
sub.subscribe('chan9');
133129
sub.unsubscribe('chan9');
@@ -138,8 +134,6 @@ describe("publish/subscribe", function () {
138134
});
139135

140136
it('handles SUB_UNSUB_MSG_SUB 2', function (done) {
141-
helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]);
142-
143137
sub.psubscribe('abc*');
144138
sub.subscribe('xyz');
145139
sub.unsubscribe('xyz');
@@ -241,8 +235,6 @@ describe("publish/subscribe", function () {
241235
});
242236

243237
it('executes callback when unsubscribe is called and there are no subscriptions', function (done) {
244-
helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]);
245-
246238
pub.unsubscribe(function (err, results) {
247239
assert.strictEqual(null, results);
248240
return done(err);
@@ -270,8 +262,6 @@ describe("publish/subscribe", function () {
270262
});
271263

272264
it('executes callback when punsubscribe is called and there are no subscriptions', function (done) {
273-
helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]);
274-
275265
pub.punsubscribe(function (err, results) {
276266
assert.strictEqual(null, results);
277267
return done(err);

0 commit comments

Comments
 (0)