summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2018-03-13 16:14:36 -0400
committerJudah Schvimer <judah@mongodb.com>2018-04-18 16:10:45 -0400
commit0e85602411f0bf38af7eb0efe816d0ca0c58b0c8 (patch)
tree5d6f44a4dbf66c93c9919334ca572cdf02ab6406
parent656969f94fd597e4f78f3824dd643ff6b5028286 (diff)
downloadmongo-0e85602411f0bf38af7eb0efe816d0ca0c58b0c8.tar.gz
SERVER-33734 Improve jsTestLog filterability
(cherry picked from commit 54dc55063a25fdcae65356c2515e55768181dc80)
-rw-r--r--jstests/sharding/read_pref_cmd.js2
-rw-r--r--jstests/sharding/zbigMapReduce.js2
-rw-r--r--src/mongo/shell/utils.js4
3 files changed, 5 insertions, 3 deletions
diff --git a/jstests/sharding/read_pref_cmd.js b/jstests/sharding/read_pref_cmd.js
index b9f275ea962..54effe9f249 100644
--- a/jstests/sharding/read_pref_cmd.js
+++ b/jstests/sharding/read_pref_cmd.js
@@ -200,7 +200,7 @@ var testBadMode = function(conn, hostList, isMongos, mode, tagSets) {
testDB.runReadCommand({distinct: 'user', key: 'x'});
failureMsg = "Unexpected success running distinct!";
} catch (e) {
- jsTest.log(e);
+ jsTest.log(e.toString());
}
if (failureMsg)
diff --git a/jstests/sharding/zbigMapReduce.js b/jstests/sharding/zbigMapReduce.js
index 733e166745f..a1b44ab0e8a 100644
--- a/jstests/sharding/zbigMapReduce.js
+++ b/jstests/sharding/zbigMapReduce.js
@@ -135,7 +135,7 @@ function runTest(s) {
db.foo.mapReduce(map, reduce, {out: {replace: "big_out", nonAtomic: true}});
});
- jsTest.log();
+ jsTest.log("Adding documents");
// Add docs with dup "i"
valInc = 0;
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index f8ed9b64ee3..a1bb04c6bfb 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -258,7 +258,9 @@ setJsTestOption = function(name, value) {
};
jsTestLog = function(msg) {
- print("\n\n----\n" + msg + "\n----\n\n");
+ assert.eq(typeof(msg), "string", "Received: " + msg);
+ const msgs = ["----", ...msg.split("\n"), "----"].map(s => `[jsTest] ${s}`);
+ print(`\n\n${msgs.join("\n")}\n\n`);
};
jsTest = {};