summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/startup_logging.js
blob: d1b73bb1c56ad4f5ec450121698a16dc0efeb27c (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
/**
 * 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(/waiting for connections on port/));
    }

    print("********************\nTesting startup logging in mongod\n********************");

    validateWaitingMessage({
        start: function(opts) {
            return MongoRunner.runMongod(opts);
        },
        stop: MongoRunner.stopMongod
    });

}());