0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-24 16:46:00 +01:00
mongodb/jstests/replsets/reconfig_uses_default_protocolVersion.js
Matt Broadstone 771dabd098 SERVER-81339 Convert ReplSetTest and ShardingTest to modules (#26332)
GitOrigin-RevId: 744aa110a53786b23c62ff53f87a1418b5991e8d
2024-08-20 22:00:49 +00:00

21 lines
608 B
JavaScript

/**
* Test that protocolVersion defaults to 1 even during a replSetReconfig.
*/
import {ReplSetTest} from "jstests/libs/replsettest.js";
var rst = new ReplSetTest({nodes: 2});
rst.startSet();
rst.initiate();
const primary = rst.getPrimary();
var 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();