diff options
author | Adam Midvidy <amidvidy@gmail.com> | 2016-03-03 15:19:34 -0500 |
---|---|---|
committer | Adam Midvidy <amidvidy@gmail.com> | 2016-03-04 15:27:08 -0500 |
commit | 4370186cb29196c2187aa54cdafb2c9b5293704d (patch) | |
tree | ba728e157b8aedd658f4343a622e27dbe381f1e9 /jstests/noPassthrough | |
parent | 943984e0a101c97408abbdd1762a5918cabcfa30 (diff) | |
download | mongo-4370186cb29196c2187aa54cdafb2c9b5293704d.tar.gz |
SERVER-22737 make exit logging.js more robust
- improve error message if test fails
- don't limit output of RawMongoProgramOutput
Diffstat (limited to 'jstests/noPassthrough')
-rw-r--r-- | jstests/noPassthrough/exit_logging.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/jstests/noPassthrough/exit_logging.js b/jstests/noPassthrough/exit_logging.js index b0e2b65cc02..c40df9152e2 100644 --- a/jstests/noPassthrough/exit_logging.js +++ b/jstests/noPassthrough/exit_logging.js @@ -25,17 +25,29 @@ function testShutdownLogging(launcher, crashFn, matchFn, expectedExitCode) { clearRawMongoProgramOutput(); var conn = launcher.start({}); + + function checkOutput() { + var logContents = ""; + assert.soon(() => { + logContents = rawMongoProgramOutput(); + return matchFn(logContents); + }, function() { + // We can't just return a string because it will be well over the max line length. + // So we just print manually. + print("================ BEGIN LOG CONTENTS =================="); + logContents.split(/\n/).forEach((line) => { print(line); }); + print("================ END LOG CONTENTS ====================="); + return ""; + }, 30000); + } + try { crashFn(conn); + checkOutput(); } finally { launcher.stop(conn, undefined, { allowedExitCodes: [ expectedExitCode ] }); } - - assert.soon(() => { - var logContents = rawMongoProgramOutput(); - return matchFn(logContents); - }, "Log contents should match", 120000); } function runAllTests(launcher) { |