summaryrefslogtreecommitdiff
path: root/jstests/replsets/reconfig_uses_default_protocolVersion.js
blob: 706872b9522849f3045d13d1c01c5c3437e00919 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
 * Test that protocolVersion defaults to 1 even during a replSetReconfig.
 */
(function() {
"use strict";

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();
})();