diff options
author | David Storch <david.storch@10gen.com> | 2015-07-27 14:46:08 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-07-28 16:21:12 -0400 |
commit | 645e9ad9dba32abf96a4d58abbf5c6be205c57cc (patch) | |
tree | 39f012c7ea25d4b39571751e82d64e9823041fe9 | |
parent | 7ac64c6f36f9aaea0367fe67a29a08ec1c6e584a (diff) | |
download | mongo-645e9ad9dba32abf96a4d58abbf5c6be205c57cc.tar.gz |
SERVER-17544 update tests depending on OP_QUERY/OP_GET_MORE specific behavior
--Use of 'orderby' is not allowed for find command.
--Passing a negative value for .batchSize() is no longer legal.
--Find command accepts 64-bit skip and limit values.
--Slow log line format has changed for find command.
-rw-r--r-- | jstests/core/getlog2.js | 4 | ||||
-rw-r--r-- | jstests/core/or4.js | 2 | ||||
-rw-r--r-- | jstests/core/skip1.js | 17 | ||||
-rw-r--r-- | jstests/core/sort3.js | 5 |
4 files changed, 15 insertions, 13 deletions
diff --git a/jstests/core/getlog2.js b/jstests/core/getlog2.js index 846f0548309..ee836ecd640 100644 --- a/jstests/core/getlog2.js +++ b/jstests/core/getlog2.js @@ -30,7 +30,9 @@ if(db.isMaster().msg != "isdbgrid") { // ensure that slow query is logged in detail assert( contains(resp.log, function(v) { print(v); - return v.indexOf(" query ") != -1 && v.indexOf("query:") != -1 && + var opString = db.getMongo().useReadCommands() ? " find " : " query "; + var filterString = db.getMongo().useReadCommands() ? "filter:" : "query:"; + return v.indexOf(opString) != -1 && v.indexOf(filterString) != -1 && v.indexOf("nscanned:") != -1 && v.indexOf("nscannedObjects:") != -1 && v.indexOf("SENTINEL") != -1; diff --git a/jstests/core/or4.js b/jstests/core/or4.js index a47884364c3..8d624759c34 100644 --- a/jstests/core/or4.js +++ b/jstests/core/or4.js @@ -71,7 +71,7 @@ assert.eq.automsg( "4", "t.find( {$or:[{a:2},{b:3}]} ).batchSize( 2 ).toArray(). assert.eq.automsg( "4", "t.find( {$or:[{a:2},{b:3}]} ).snapshot().toArray().length" ); t.save( {a:1,b:3} ); -assert.eq.automsg( "4", "t.find( {$or:[{a:2},{b:3}]} ).batchSize(-4).toArray().length" ); +assert.eq.automsg( "4", "t.find( {$or:[{a:2},{b:3}]} ).limit(4).toArray().length" ); assert.eq.automsg( "[1,2]", "Array.sort( t.distinct( 'a', {$or:[{a:2},{b:3}]} ) )" ); diff --git a/jstests/core/skip1.js b/jstests/core/skip1.js index c1895e8889a..c856e92cf72 100644 --- a/jstests/core/skip1.js +++ b/jstests/core/skip1.js @@ -23,9 +23,14 @@ for (var i = 0; i < 10; i++) { } assert.eq( 9, t.find().sort({a: 1}).limit(2147483647).skip(1).itcount() ); assert.eq( 0, t.find().sort({a: 1}).skip(2147483647).limit(1).itcount() ); -assert.throws( function() { - assert.eq( 0, t.find().sort({a: 1}).skip(2147483648).itcount() ); -}); -assert.throws( function() { - assert.eq( 0, t.find().sort({a: 1}).limit(2147483648).itcount() ); -}); + +if (!db.getMongo().useReadCommands()) { + // If we're using OP_QUERY/OP_GET_MORE reads rather than find/getMore command, then the skip and + // limit fields must fit inside a 32-bit signed integer. + assert.throws( function() { + assert.eq( 0, t.find().sort({a: 1}).skip(2147483648).itcount() ); + }); + assert.throws( function() { + assert.eq( 0, t.find().sort({a: 1}).limit(2147483648).itcount() ); + }); +} diff --git a/jstests/core/sort3.js b/jstests/core/sort3.js index b79f1f60381..f65b7445903 100644 --- a/jstests/core/sort3.js +++ b/jstests/core/sort3.js @@ -1,4 +1,3 @@ - t = db.sort3; t.drop(); @@ -10,7 +9,3 @@ assert.eq( "1,5,3" , t.find().toArray().map( function(z){ return z.a; } ) ); assert.eq( "1,3,5" , t.find().sort( { a : 1 } ).toArray().map( function(z){ return z.a; } ) ); assert.eq( "5,3,1" , t.find().sort( { a : -1 } ).toArray().map( function(z){ return z.a; } ) ); - -assert.eq( "1,3,5" , t.find( { query : {} , orderby : { a : 1 } } ).toArray().map( function(z){ return z.a; } ) ); -assert.eq( "5,3,1" , t.find( { query : {} , orderby : { a : -1 } } ).toArray().map( function(z){ return z.a; } ) ); - |