diff --git a/test/batch.spec.js b/test/batch.spec.js index 575544fe99..caf4e7b8ef 100644 --- a/test/batch.spec.js +++ b/test/batch.spec.js @@ -328,8 +328,6 @@ describe("The 'batch' method", function () { }); it("should work without any callback", function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 5]); - var batch = client.batch(); batch.set("baz", "binary"); batch.set("foo", "bar"); diff --git a/test/commands/client.spec.js b/test/commands/client.spec.js index e26df12ec4..f0f1f205ad 100644 --- a/test/commands/client.spec.js +++ b/test/commands/client.spec.js @@ -68,8 +68,6 @@ describe("The 'client' method", function () { }); it('sets the name', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 9]); - // The querys are auto pipelined and the response is a response to all querys of one client // per chunk. So the execution order is only garanteed on each client var end = helper.callFuncAfter(done, 2); diff --git a/test/commands/eval.spec.js b/test/commands/eval.spec.js index 53cff94e71..d091a4dbd7 100644 --- a/test/commands/eval.spec.js +++ b/test/commands/eval.spec.js @@ -26,32 +26,26 @@ describe("The 'eval' method", function () { }); it('converts a float to an integer when evaluated', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval("return 100.5", 0, helper.isNumber(100, done)); }); it('returns a string', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval("return 'hello world'", 0, helper.isString('hello world', done)); }); it('converts boolean true to integer 1', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval("return true", 0, helper.isNumber(1, done)); }); it('converts boolean false to null', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval("return false", 0, helper.isNull(done)); }); it('converts lua status code to string representation', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval("return {ok='fine'}", 0, helper.isString('fine', done)); }); it('converts lua error to an error response', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval("return {err='this is an error'}", 0, function(err) { assert(err.code === undefined); helper.isError()(err); @@ -60,7 +54,6 @@ describe("The 'eval' method", function () { }); it('represents a lua table appropritely', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval("return {1,2,3,'ciao',{1,2}}", 0, function (err, res) { assert.strictEqual(5, res.length); assert.strictEqual(1, res[0]); @@ -75,7 +68,6 @@ describe("The 'eval' method", function () { }); it('populates keys and argv correctly', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d", function (err, res) { assert.strictEqual(4, res.length); assert.strictEqual("a", res[0]); @@ -87,7 +79,6 @@ describe("The 'eval' method", function () { }); it('allows arguments to be provided in array rather than as multiple parameters', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval(["return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 2, "a", "b", "c", "d"], function (err, res) { assert.strictEqual(4, res.length); assert.strictEqual("a", res[0]); @@ -99,7 +90,6 @@ describe("The 'eval' method", function () { }); it('allows a script to be executed that accesses the redis API without callback', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval(source, 0); client.get('sha', helper.isString('test', done)); }); @@ -108,24 +98,20 @@ describe("The 'eval' method", function () { var sha = crypto.createHash('sha1').update(source).digest('hex'); it('allows a script to be executed that accesses the redis API', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval(source, 0, helper.isString('OK')); client.get('sha', helper.isString('test', done)); }); it('can execute a script if the SHA exists', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.evalsha(sha, 0, helper.isString('OK')); client.get('sha', helper.isString('test', done)); }); it('returns an error if SHA does not exist', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0, helper.isError(done)); }); it('emit an error if SHA does not exist without any callback', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.evalsha('ffffffffffffffffffffffffffffffffffffffff', 0); client.on('error', function(err) { assert.equal(err.code, 'NOSCRIPT'); @@ -144,7 +130,6 @@ describe("The 'eval' method", function () { }); it('allows a key to be incremented, and performs appropriate conversion from LUA type', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.set("incr key", 0, function (err, reply) { if (err) return done(err); 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 () { }); it('allows a bulk operation to be performed, and performs appropriate conversion from LUA type', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.set("bulk reply key", "bulk reply value", function (err, res) { client.eval("local foo = redis.call('get','bulk reply key'); return {type(foo),foo}", 0, function (err, res) { assert.strictEqual(2, res.length); @@ -169,7 +153,6 @@ describe("The 'eval' method", function () { }); it('allows a multi mulk operation to be performed, with the appropriate type conversion', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.multi() .del("mylist") .rpush("mylist", "a") @@ -190,7 +173,6 @@ describe("The 'eval' method", function () { }); it('returns an appropriate representation of Lua status reply', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.eval("local foo = redis.call('set','mykey','myval'); return {type(foo),foo['ok']}", 0, function (err, res) { assert.strictEqual(2, res.length); assert.strictEqual("table", res[0]); @@ -200,7 +182,6 @@ describe("The 'eval' method", function () { }); it('returns an appropriate representation of a Lua error reply', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.set("error reply key", "error reply value", function (err, res) { if (err) return done(err); 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 () { }); it('returns an appropriate representation of a Lua nil reply', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 5, 0]); client.del("nil reply key", function (err, res) { if (err) return done(err); client.eval("local foo = redis.call('get','nil reply key'); return {type(foo),foo == false}", 0, function (err, res) { diff --git a/test/commands/script.spec.js b/test/commands/script.spec.js index a82ab09d19..e7eecc172b 100644 --- a/test/commands/script.spec.js +++ b/test/commands/script.spec.js @@ -27,7 +27,6 @@ describe("The 'script' method", function () { }); it("loads script with client.script('load')", function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 0]); client.script("load", command, function(err, result) { assert.strictEqual(result, commandSha); return done(); @@ -35,12 +34,10 @@ describe("The 'script' method", function () { }); it('allows a loaded script to be evaluated', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 0]); client.evalsha(commandSha, 0, helper.isString('99', done)); }); it('allows a script to be loaded as part of a chained transaction', function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 0]); client.multi().script("load", command).exec(function(err, result) { assert.strictEqual(result[0], commandSha); return done(); @@ -48,7 +45,6 @@ describe("The 'script' method", function () { }); it("allows a script to be loaded using a transaction's array syntax", function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 0]); client.multi([['script', 'load', command]]).exec(function(err, result) { assert.strictEqual(result[0], commandSha); return done(); diff --git a/test/multi.spec.js b/test/multi.spec.js index d4f0250200..63541e8a50 100644 --- a/test/multi.spec.js +++ b/test/multi.spec.js @@ -251,25 +251,18 @@ describe("The 'multi' method", function () { it('roles back a transaction when one command in a sequence of commands fails', function (done) { var multi1, multi2; - var expected = helper.serverVersionAtLeast(client, [2, 6, 5]) ? helper.isError() : function () {}; - // Provoke an error at queue time multi1 = client.MULTI(); multi1.mset("multifoo", "10", "multibar", "20", helper.isString("OK")); - multi1.set("foo2", expected); + multi1.set("foo2", helper.isError()); multi1.incr("multifoo"); multi1.incr("multibar"); multi1.exec(function () { // Redis 2.6.5+ will abort transactions with errors // see: http://redis.io/topics/transactions - var multibar_expected = 22; - var multifoo_expected = 12; - if (helper.serverVersionAtLeast(client, [2, 6, 5])) { - multibar_expected = 1; - multifoo_expected = 1; - } - + var multibar_expected = 1; + var multifoo_expected = 1; // Confirm that the previous command, while containing an error, still worked. multi2 = client.multi(); multi2.incr("multibar", helper.isNumber(multibar_expected)); @@ -283,8 +276,6 @@ describe("The 'multi' method", function () { }); it('roles back a transaction when one command in an array of commands fails', function (done) { - var expected = helper.serverVersionAtLeast(client, [2, 6, 5]) ? helper.isError() : function () {}; - // test nested multi-bulk replies client.multi([ ["mget", "multifoo", "multibar", function (err, res) { @@ -292,22 +283,12 @@ describe("The 'multi' method", function () { assert.strictEqual(0, +res[0]); assert.strictEqual(0, +res[1]); }], - ["set", "foo2", expected], + ["set", "foo2", helper.isError()], ["incr", "multifoo"], ["incr", "multibar"] ]).exec(function (err, replies) { - if (helper.serverVersionAtLeast(client, [2, 6, 5])) { - assert.notEqual(err, null); - assert.equal(replies, undefined); - } else { - assert.strictEqual(2, replies[0].length); - assert.strictEqual(null, replies[0][0]); - assert.strictEqual(null, replies[0][1]); - - assert.strictEqual("1", replies[1].toString()); - assert.strictEqual("1", replies[2].toString()); - } - + assert.notEqual(err, null); + assert.equal(replies, undefined); return done(); }); }); @@ -537,8 +518,6 @@ describe("The 'multi' method", function () { }); it("emits an error if no callback has been provided and execabort error occured", function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 5]); - var multi = client.multi(); multi.config("bar"); multi.set("foo"); @@ -551,8 +530,6 @@ describe("The 'multi' method", function () { }); it("should work without any callback", function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 5]); - var multi = client.multi(); multi.set("baz", "binary"); multi.set("foo", "bar"); @@ -583,8 +560,6 @@ describe("The 'multi' method", function () { }); it("should use transaction with exec_atomic and more than one command used", function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 5]); - var multi = client.multi(); var test = false; multi.exec_batch = function () { @@ -597,8 +572,6 @@ describe("The 'multi' method", function () { }); it("do not mutate arguments in the multi constructor", function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 5]); - var input = [['set', 'foo', 'bar'], ['get', 'foo']]; client.multi(input).exec(function (err, res) { assert.strictEqual(input.length, 2); @@ -609,8 +582,6 @@ describe("The 'multi' method", function () { }); it("works properly after a reconnect. issue #897", function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 5]); - client.stream.destroy(); client.on('error', function (err) { assert.strictEqual(err.code, 'ECONNREFUSED'); @@ -625,8 +596,6 @@ describe("The 'multi' method", function () { }); it("emits error once if reconnecting after multi has been executed but not yet returned without callback", function (done) { - helper.serverVersionAtLeast.call(this, client, [2, 6, 5]); - client.on('error', function(err) { assert.strictEqual(err.code, 'UNCERTAIN_STATE'); done(); diff --git a/test/node_redis.spec.js b/test/node_redis.spec.js index 03098115d9..521b9ab760 100644 --- a/test/node_redis.spec.js +++ b/test/node_redis.spec.js @@ -345,8 +345,6 @@ 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 = []; diff --git a/test/pubsub.spec.js b/test/pubsub.spec.js index 906f0eb978..081399fd48 100644 --- a/test/pubsub.spec.js +++ b/test/pubsub.spec.js @@ -104,8 +104,6 @@ describe("publish/subscribe", function () { }); it('receives messages if subscribe is called after unsubscribe', function (done) { - helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]); - var end = helper.callFuncAfter(done, 2); sub.once("subscribe", function (chnl, count) { pub.publish(channel, message, function (err, res) { @@ -126,8 +124,6 @@ describe("publish/subscribe", function () { }); it('handles SUB_UNSUB_MSG_SUB', function (done) { - helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]); - sub.subscribe('chan8'); sub.subscribe('chan9'); sub.unsubscribe('chan9'); @@ -138,8 +134,6 @@ describe("publish/subscribe", function () { }); it('handles SUB_UNSUB_MSG_SUB 2', function (done) { - helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]); - sub.psubscribe('abc*'); sub.subscribe('xyz'); sub.unsubscribe('xyz'); @@ -241,8 +235,6 @@ describe("publish/subscribe", function () { }); it('executes callback when unsubscribe is called and there are no subscriptions', function (done) { - helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]); - pub.unsubscribe(function (err, results) { assert.strictEqual(null, results); return done(err); @@ -270,8 +262,6 @@ describe("publish/subscribe", function () { }); it('executes callback when punsubscribe is called and there are no subscriptions', function (done) { - helper.serverVersionAtLeast.bind(this)(sub, [2, 6, 11]); - pub.punsubscribe(function (err, results) { assert.strictEqual(null, results); return done(err);