mongo/jstests/replsets/reconfig_uses_default_protocolVersion.js
Steve McClure 1ffbc6c2e9 SERVER-109432: Autofix JS var usage to favor let (#40637)
GitOrigin-RevId: 9674b7db36a0f3f650d39c1e3fb2ad6ff2141cfb
2025-08-28 19:21:01 +00:00

22 lines
609 B
JavaScript

/**
* Test that protocolVersion defaults to 1 even during a replSetReconfig.
*/
import {ReplSetTest} from "jstests/libs/replsettest.js";
let rst = new ReplSetTest({nodes: 2});
rst.startSet();
rst.initiate();
const primary = rst.getPrimary();
let config = primary.getDB("local").system.replset.findOne();
config.version++;
delete config.protocolVersion;
assert.commandWorked(primary.adminCommand({replSetReconfig: config}));
// Make sure that the config still has the proper protocolVersion.
config = primary.getDB("local").system.replset.findOne();
assert.eq(config.protocolVersion, 1);
rst.stopSet();