diff options
author | David Storch <david.storch@10gen.com> | 2017-10-05 13:49:43 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2017-10-06 09:42:26 -0400 |
commit | aff9c7e6afe0b78e91a724fe5e53ea4717d7d813 (patch) | |
tree | 019aed444c041a08bb06f3854e80d2273de1996d /jstests/core | |
parent | 3fabd4fdc675653133846062aba68f9c49667c1c (diff) | |
download | mongo-aff9c7e6afe0b78e91a724fe5e53ea4717d7d813.tar.gz |
SERVER-31366 Use filters in getLatestProfilerEntry() to make profile_getmore.js more robust.
Diffstat (limited to 'jstests/core')
-rw-r--r-- | jstests/core/profile_getmore.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/jstests/core/profile_getmore.js b/jstests/core/profile_getmore.js index a6772b38900..90f8e323f84 100644 --- a/jstests/core/profile_getmore.js +++ b/jstests/core/profile_getmore.js @@ -23,12 +23,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)); @@ -66,7 +67,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)); @@ -82,7 +83,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. @@ -100,12 +101,12 @@ assert.commandWorked(coll.createIndex({a: 1})); var cursor = coll.aggregate([{$match: {a: {$gte: 0}}}], {cursor: {batchSize: 0}, hint: {a: 1}}); - 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)); @@ -140,7 +141,7 @@ cursor = coll.find(docToInsert).comment("profile_getmore").batchSize(2); assert.eq(cursor.itcount(), 4); // Consume result set and trigger getMore. - profileObj = getLatestProfilerEntry(testDB); + profileObj = getLatestProfilerEntry(testDB, {op: "getmore"}); assert.eq((typeof profileObj.originatingCommand.$truncated), "string", tojson(profileObj)); assert.eq(profileObj.originatingCommand.comment, "profile_getmore", tojson(profileObj)); })(); |