Files
mongo/jstests/replsets/reconfig_commitment_succeeds_with_arbiter.js
Matt Broadstone 771dabd098 SERVER-81339 Convert ReplSetTest and ShardingTest to modules (#26332)
GitOrigin-RevId: 744aa110a53786b23c62ff53f87a1418b5991e8d
2024-08-20 22:00:49 +00:00

31 lines
815 B
JavaScript

/**
* Verify that a non force replica set reconfig can be committed by a primary and arbiter, with a
* secondary down.
*/
import {ReplSetTest} from "jstests/libs/replsettest.js";
// Make the secondary unelectable.
let rst =
new ReplSetTest({nodes: [{}, {rsConfig: {priority: 0}}, {rsConfig: {arbiterOnly: true}}]});
rst.startSet();
rst.initiate();
const primary = rst.getPrimary();
const secondary = rst.getSecondary();
jsTestLog("Shut down secondary.");
rst.stop(secondary);
jsTestLog("Safe reconfig twice to prove reconfigs are committed with secondary down.");
var config = rst.getReplSetConfigFromNode();
for (let i = 0; i < 2; i++) {
config.version++;
assert.commandWorked(primary.adminCommand({replSetReconfig: config}));
}
rst.restart(secondary);
rst.awaitReplication();
rst.stopSet();