summaryrefslogtreecommitdiff
path: root/jstests/replsets/replsettest_stop_with_default_rwc.js
blob: 2e5289b80ac700603b94ecf5380c7d8cfb19e7fd (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
/**
 * Tests that none of the operations in the ReplSetTest consistency checks are affected by
 * changing the default read or write concern during the test itself.
 */
(function() {
"use strict";

const name = jsTestName();

// We need to have at least 2 nodes to run the data consistency checks.
const rst = new ReplSetTest({name: name, nodes: 2});
rst.startSet();
rst.initiate();

// Deliberately set a write concern and read concern that are different from the default w:1 and
// local values.
// The write concern is unsatisfiable, so any operations run in the shutdown hooks will fail if
// they inherit it.
assert.commandWorked(rst.getPrimary().adminCommand({
    setDefaultRWConcern: 1,
    defaultWriteConcern: {w: 42},
    defaultReadConcern: {level: "majority"}
}));

// It should always be possible to successfully stop the replset (including running consistency
// checks) even when the default write concern is unsatisfiable.
rst.stopSet();
})();