summaryrefslogtreecommitdiff
path: root/jstests/libs/profiler.js
diff options
context:
space:
mode:
authorBernard Gorman <bernard.gorman@gmail.com>2017-01-17 20:47:21 +0000
committerJames Wahlin <james.wahlin@10gen.com>2017-01-18 12:08:17 -0500
commite8893fc311ac12028dafcf4416c2f534a42f1cf7 (patch)
tree5edfe869a5f36db525872bcdc049b39d724f7e19 /jstests/libs/profiler.js
parent2ff3efcabb0a43d5d21b3d636caa76efa4df8bd3 (diff)
downloadmongo-e8893fc311ac12028dafcf4416c2f534a42f1cf7.tar.gz
SERVER-27438 Prevent mongos from dropping legacy $comment meta-operator
Closes #1135 Signed-off-by: James Wahlin <james.wahlin@10gen.com>
Diffstat (limited to 'jstests/libs/profiler.js')
-rw-r--r--jstests/libs/profiler.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/jstests/libs/profiler.js b/jstests/libs/profiler.js
index b7c4a3f89e7..c0fc210c928 100644
--- a/jstests/libs/profiler.js
+++ b/jstests/libs/profiler.js
@@ -14,4 +14,13 @@ function getProfilerProtocolStringForCommand(conn) {
}
return "op_command";
+}
+
+// Throws an assertion if the profiler does not contain exactly one entry matching <filter>.
+// Optional arguments <errorMsgFilter> and <errorMsgProj> limit profiler output if this asserts.
+function profilerHasSingleMatchingEntryOrThrow(inputDb, filter, errorMsgFilter, errorMsgProj) {
+ assert.eq(inputDb.system.profile.find(filter).itcount(),
+ 1,
+ "Expected exactly one op matching: " + tojson(filter) + " in profiler " +
+ tojson(inputDb.system.profile.find(errorMsgFilter, errorMsgProj).toArray()));
} \ No newline at end of file