summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/supports_read_concern_majority.js
blob: 64cc5b7dad17a53571dd20f32f11c86c00f84bcf (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
/**
 * Tests that mongod fails to start if enableMajorityReadConcern is set to false on non test only
 * storage engines, which are only expected to support read concern majority.
 *
 * Also verifies that the server automatically uses enableMajorityReadConcern=false if we're using a
 * test only storage engine.
 */
(function() {
"use strict";

const storageEngine = jsTest.options().storageEngine;
if (storageEngine === "wiredTiger" || storageEngine === "inMemory") {
    const conn = MongoRunner.runMongod({enableMajorityReadConcern: false});
    assert(!conn);
    var logContents = rawMongoProgramOutput();
    assert(logContents.indexOf("enableMajorityReadConcern:false is no longer supported") > 0);
    return;
}

if (storageEngine === "ephemeralForTest") {
    const conn = MongoRunner.runMongod();
    assert(conn);
    var logContents = rawMongoProgramOutput();
    assert(
        logContents.indexOf(
            "Test storage engine does not support enableMajorityReadConcern=true, forcibly setting to false") >
        0);
    MongoRunner.stopMongod(conn);
    return;
}
})();