diff options
Diffstat (limited to 'jstests/core/getmore_cmd_maxtimems.js')
-rw-r--r-- | jstests/core/getmore_cmd_maxtimems.js | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/jstests/core/getmore_cmd_maxtimems.js b/jstests/core/getmore_cmd_maxtimems.js index 7b13f858bc1..1b8e20ba962 100644 --- a/jstests/core/getmore_cmd_maxtimems.js +++ b/jstests/core/getmore_cmd_maxtimems.js @@ -4,46 +4,46 @@ // Test attaching maxTimeMS to a getMore command. (function() { - 'use strict'; - - var cmdRes; - var collName = 'getmore_cmd_maxtimems'; - var coll = db[collName]; - coll.drop(); - - for (var i = 0; i < 10; i++) { - assert.writeOK(coll.insert({a: i})); - } - - // Can't attach maxTimeMS to a getMore command for a non-tailable cursor over a non-capped - // collection. - cmdRes = db.runCommand({find: collName, batchSize: 2}); - assert.commandWorked(cmdRes); - cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 60000}); - assert.commandFailed(cmdRes); - - coll.drop(); - assert.commandWorked(db.createCollection(collName, {capped: true, size: 1024})); - for (var i = 0; i < 10; i++) { - assert.writeOK(coll.insert({a: i})); - } - - // Can't attach maxTimeMS to a getMore command for a non-tailable cursor over a capped - // collection. - cmdRes = db.runCommand({find: collName, batchSize: 2}); - assert.commandWorked(cmdRes); - cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 60000}); - assert.commandFailed(cmdRes); - - // Can't attach maxTimeMS to a getMore command for a non-awaitData tailable cursor. - cmdRes = db.runCommand({find: collName, batchSize: 2, tailable: true}); - assert.commandWorked(cmdRes); - cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 60000}); - assert.commandFailed(cmdRes); - - // Can attach maxTimeMS to a getMore command for an awaitData cursor. - cmdRes = db.runCommand({find: collName, batchSize: 2, tailable: true, awaitData: true}); - assert.commandWorked(cmdRes); - cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 60000}); - assert.commandWorked(cmdRes); +'use strict'; + +var cmdRes; +var collName = 'getmore_cmd_maxtimems'; +var coll = db[collName]; +coll.drop(); + +for (var i = 0; i < 10; i++) { + assert.writeOK(coll.insert({a: i})); +} + +// Can't attach maxTimeMS to a getMore command for a non-tailable cursor over a non-capped +// collection. +cmdRes = db.runCommand({find: collName, batchSize: 2}); +assert.commandWorked(cmdRes); +cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 60000}); +assert.commandFailed(cmdRes); + +coll.drop(); +assert.commandWorked(db.createCollection(collName, {capped: true, size: 1024})); +for (var i = 0; i < 10; i++) { + assert.writeOK(coll.insert({a: i})); +} + +// Can't attach maxTimeMS to a getMore command for a non-tailable cursor over a capped +// collection. +cmdRes = db.runCommand({find: collName, batchSize: 2}); +assert.commandWorked(cmdRes); +cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 60000}); +assert.commandFailed(cmdRes); + +// Can't attach maxTimeMS to a getMore command for a non-awaitData tailable cursor. +cmdRes = db.runCommand({find: collName, batchSize: 2, tailable: true}); +assert.commandWorked(cmdRes); +cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 60000}); +assert.commandFailed(cmdRes); + +// Can attach maxTimeMS to a getMore command for an awaitData cursor. +cmdRes = db.runCommand({find: collName, batchSize: 2, tailable: true, awaitData: true}); +assert.commandWorked(cmdRes); +cmdRes = db.runCommand({getMore: cmdRes.cursor.id, collection: collName, maxTimeMS: 60000}); +assert.commandWorked(cmdRes); })(); |