summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/startup_logging.js
blob: 13d90ed186e0968e02b990a3ef335a05a316f4b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
 * 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
});
}());