summaryrefslogtreecommitdiff
path: root/jstests/replsets/get_default_write_concern_majority.js
blob: 925c8f980aa58c444a25471b9a250a856f399357 (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
/**
 * This tests the behavior of changing the default write concern to the implicit default if there is
 * no CWWC.
 * @tags: [
 * ]
 */
(function() {
'use strict';

jsTestLog("Test PSS configuration will set defaultWC to majority.");
let replTest = new ReplSetTest({name: 'default_wc_majority', nodes: 3});
replTest.startSet();
replTest.initiate();
let primary = replTest.getPrimary();

let res = assert.commandWorked(primary.adminCommand({getDefaultRWConcern: 1}));
assert(res.hasOwnProperty("defaultWriteConcern"));
assert.eq({w: "majority", wtimeout: 0}, res.defaultWriteConcern, tojson(res));

replTest.stopSet();

jsTestLog("Test PSA configuration will set defaultWC to {w:1}.");
replTest = new ReplSetTest({name: 'default_wc_w_1', nodes: [{}, {}, {arbiter: true}]});
replTest.startSet();
replTest.initiate();
primary = replTest.getPrimary();

res = assert.commandWorked(primary.adminCommand({getDefaultRWConcern: 1}));
assert(!res.hasOwnProperty("defaultWriteConcern"));

replTest.stopSet();
})();