From 4370186cb29196c2187aa54cdafb2c9b5293704d Mon Sep 17 00:00:00 2001 From: Adam Midvidy Date: Thu, 3 Mar 2016 15:19:34 -0500 Subject: SERVER-22737 make exit logging.js more robust - improve error message if test fails - don't limit output of RawMongoProgramOutput --- jstests/noPassthrough/exit_logging.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'jstests/noPassthrough') 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) { -- cgit v1.2.1