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 08:08:41 -0500
commit0eeb9396ff46269c2181e5d4aeab629863d875d4 (patch)
tree8029fb430df74c6c58b6f68283a2726bc2a967fa /jstests/libs/profiler.js
parentafd3c348e1ef81dcea51221cde13976ea6271cf7 (diff)
downloadmongo-0eeb9396ff46269c2181e5d4aeab629863d875d4.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