summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2017-10-05 13:49:43 -0400
committerDavid Storch <david.storch@10gen.com>2017-10-09 13:23:17 -0400
commit1b3b9fdec94021c36def1c9d021c4104b3677aa4 (patch)
tree732aa4bd37909d5675f4c35a6c7d46a163a1a3bc
parent86074afe12ce3fb4b6a6ed94972423bde5b52800 (diff)
downloadmongo-1b3b9fdec94021c36def1c9d021c4104b3677aa4.tar.gz
SERVER-31366 Use filters in getLatestProfilerEntry() to make profile_getmore.js more robust.
(cherry picked from commit aff9c7e6afe0b78e91a724fe5e53ea4717d7d813) Conflicts: jstests/core/profile_getmore.js
-rw-r--r--jstests/core/profile_getmore.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/jstests/core/profile_getmore.js b/jstests/core/profile_getmore.js
index a9272567b1a..3f6f492597e 100644
--- a/jstests/core/profile_getmore.js
+++ b/jstests/core/profile_getmore.js
@@ -24,12 +24,13 @@
var cursor = coll.find({a: {$gt: 0}}).sort({a: 1}).batchSize(2);
cursor.next(); // Perform initial query and consume first of 2 docs returned.
- var cursorId = getLatestProfilerEntry(testDB).cursorid; // Save cursorid from find.
+ var cursorId =
+ getLatestProfilerEntry(testDB, {op: "query"}).cursorid; // Save cursorid from find.
cursor.next(); // Consume second of 2 docs from initial query.
cursor.next(); // getMore performed, leaving open cursor.
- var profileObj = getLatestProfilerEntry(testDB);
+ var profileObj = getLatestProfilerEntry(testDB, {op: "getmore"});
assert.eq(profileObj.ns, coll.getFullName(), tojson(profileObj));
assert.eq(profileObj.op, "getmore", tojson(profileObj));
@@ -67,7 +68,7 @@
cursor.next(); // Consume second of 2 docs from initial query.
cursor.next(); // getMore performed, leaving open cursor.
- profileObj = getLatestProfilerEntry(testDB);
+ profileObj = getLatestProfilerEntry(testDB, {op: "getmore"});
assert.eq(profileObj.hasSortStage, true, tojson(profileObj));
@@ -83,7 +84,7 @@
cursor.next(); // Perform initial query and consume first of 3 docs returned.
cursor.itcount(); // Exhaust the cursor.
- profileObj = getLatestProfilerEntry(testDB);
+ profileObj = getLatestProfilerEntry(testDB, {op: "getmore"});
assert(profileObj.hasOwnProperty("cursorid"),
tojson(profileObj)); // cursorid should always be present on getMore.
@@ -101,12 +102,12 @@
assert.commandWorked(coll.createIndex({a: 1}));
var cursor = coll.aggregate([{$match: {a: {$gte: 0}}}], {cursor: {batchSize: 0}});
- var cursorId = getLatestProfilerEntry(testDB).cursorid;
+ var cursorId = getLatestProfilerEntry(testDB, {"command.aggregate": coll.getName()}).cursorid;
assert.neq(0, cursorId);
cursor.next(); // Consume the result set.
- profileObj = getLatestProfilerEntry(testDB);
+ profileObj = getLatestProfilerEntry(testDB, {op: "getmore"});
assert.eq(profileObj.ns, coll.getFullName(), tojson(profileObj));
assert.eq(profileObj.op, "getmore", tojson(profileObj));