summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/quiet_shell.js
blob: 83c5b2d95e54f15bca84750b5ae17740b8257b1f (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
(function() {
'use strict';

const mongo = MongoRunner.runMongod();
const regexMatch = /sh([0-9]{4,7})\|/;

// Test that a normal mongo shell gives us some noise in the raw output.
{
    const out = runMongoProgram('mongo', '--port', mongo.port, '--eval', ';');
    const mongoOutput = rawMongoProgramOutput();

    assert.gte(mongoOutput.match(regexMatch).length, 1);
}

clearRawMongoProgramOutput();

// Test that a quiet shell does not output anything.
{
    const out = runMongoProgram('mongo', '--port', mongo.port, '--quiet', '--eval', ';');
    const mongoOutput = rawMongoProgramOutput();

    assert.eq(mongoOutput.match(regexMatch), null);
}

MongoRunner.stopMongod(mongo);
})();