Files
mongo/jstests/replsets/replsettest_stop_with_default_rwc.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

29 lines
1008 B
JavaScript

/**
* 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.
*/
import {ReplSetTest} from "jstests/libs/replsettest.js";
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();