0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00
mongodb/jstests/noPassthrough/startup_logging.js
2020-03-25 15:39:36 +00:00

38 lines
887 B
JavaScript

/**
* Tests that normal startup writes to the log files as expected.
*/
(function() {
'use strict';
function makeRegExMatchFn(pattern) {
return function(text) {
return pattern.test(text);
};
}
function testStartupLogging(launcher, matchFn, expectedExitCode) {
assert(matchFn(rawMongoProgramOutput()));
}
function validateWaitingMessage(launcher) {
clearRawMongoProgramOutput();
var conn = launcher.start({});
launcher.stop(conn, undefined, {});
testStartupLogging(
launcher,
makeRegExMatchFn(
/"id":23016,\s*"ctx":"listener","msg":"Waiting for connections","attr":{"port":/));
}
print("********************\nTesting startup logging in mongod\n********************");
validateWaitingMessage({
start: function(opts) {
return MongoRunner.runMongod(opts);
},
stop: MongoRunner.stopMongod
});
}());