summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2020-02-28 14:00:06 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-02 15:41:47 +0000
commitca547df9510ec9a6dc28e6eabf1e8542870f2bd1 (patch)
tree4d8623d78224c6880788fef652be4ce1de35b611 /jstests/noPassthrough
parente264fb226be9ae2bb429824f03c05b960aa1828e (diff)
downloadmongo-ca547df9510ec9a6dc28e6eabf1e8542870f2bd1.tar.gz
SERVER-46026 Fix loglong.js to check for JSON log truncation
Diffstat (limited to 'jstests/noPassthrough')
-rw-r--r--jstests/noPassthrough/loglong.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/jstests/noPassthrough/loglong.js b/jstests/noPassthrough/loglong.js
index 0c33b3ccbe2..ff346e7f730 100644
--- a/jstests/noPassthrough/loglong.js
+++ b/jstests/noPassthrough/loglong.js
@@ -28,14 +28,14 @@ while (Object.bsonsize(query) < 30000) {
query.x.push(n++);
}
-assertLogTruncated(db, t, 9);
+assertLogTruncated(db, t);
var res = db.adminCommand({setParameter: 1, maxLogSizeKB: 8});
assert.eq(res.ok, 1);
-assertLogTruncated(db, t, 8);
+assertLogTruncated(db, t);
-function assertLogTruncated(db, t, maxLogSize) {
+function assertLogTruncated(db, t) {
var before = db.adminCommand({setParameter: 1, logLevel: 1});
t.findOne(query);
@@ -46,9 +46,9 @@ function assertLogTruncated(db, t, maxLogSize) {
var log = db.adminCommand({getLog: "global"}).log;
var found = false;
- var toFind = "warning: log line attempted (16kB) over max size (" + maxLogSize + "kB)";
for (var i = log.length - 1; i >= 0; i--) {
- if (log[i].indexOf(toFind) >= 0) {
+ var obj = JSON.parse(log[i]);
+ if (obj.hasOwnProperty("truncated")) {
found = true;
break;
}