summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorDidier Nadeau <didier.nadeau@mongodb.com>2022-05-27 15:32:48 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-27 16:44:15 +0000
commit63f17f3aef165460580a39906fc645046b4b4680 (patch)
tree8a3d57ac68c8f6446c4d007465102df692bfb6c5 /src/mongo/shell
parent834c86a44cef817ba8dce4aa24931b69c69aac50 (diff)
downloadmongo-63f17f3aef165460580a39906fc645046b4b4680.tar.gz
SERVER-62367 Add javascript test to compare shard split performance to moveChunk
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/check_log.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mongo/shell/check_log.js b/src/mongo/shell/check_log.js
index fc74d871cc1..20314c34d1d 100644
--- a/src/mongo/shell/check_log.js
+++ b/src/mongo/shell/check_log.js
@@ -30,6 +30,32 @@ checkLog = (function() {
* is found in the logs. Note: this function does not throw an exception, so the return
* value should not be ignored.
*/
+ const getLogMessage = function(conn, msg) {
+ const logMessages = getGlobalLog(conn);
+ if (logMessages === null) {
+ return null;
+ }
+ if (msg instanceof RegExp) {
+ for (let logMsg of logMessages) {
+ if (logMsg.search(msg) != -1) {
+ return logMsg;
+ }
+ }
+ } else {
+ for (let logMsg of logMessages) {
+ if (logMsg.includes(msg)) {
+ return logMsg;
+ }
+ }
+ }
+ return null;
+ };
+
+ /*
+ * Calls the 'getLog' function on the provided connection 'conn' to see if the provided msg
+ * is found in the logs. Note: this function does not throw an exception, so the return
+ * value should not be ignored.
+ */
const checkContainsOnce = function(conn, msg) {
const logMessages = getGlobalLog(conn);
if (logMessages === null) {
@@ -410,6 +436,7 @@ checkLog = (function() {
return {
getGlobalLog: getGlobalLog,
+ getLogMessage: getLogMessage,
checkContainsOnce: checkContainsOnce,
checkContainsOnceJson: checkContainsOnceJson,
checkContainsWithCountJson: checkContainsWithCountJson,