summaryrefslogtreecommitdiff
path: root/jstests/replsets/reconfig_uses_default_protocolVersion.js
diff options
context:
space:
mode:
authorSamy Lanka <samy.lanka@mongodb.com>2020-03-06 15:53:21 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-09 17:07:50 +0000
commit604c0afc97799516ba37880932948dbb008aa862 (patch)
tree236af9f58170fe4f5c8972d1ee65e60289179977 /jstests/replsets/reconfig_uses_default_protocolVersion.js
parent0bcd8d56c22cb339faf3bf8a1bf7abd838da05ad (diff)
downloadmongo-604c0afc97799516ba37880932948dbb008aa862.tar.gz
SERVER-45143 use default value for 'protocolVersion' field during reconfigs
Diffstat (limited to 'jstests/replsets/reconfig_uses_default_protocolVersion.js')
-rw-r--r--jstests/replsets/reconfig_uses_default_protocolVersion.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/jstests/replsets/reconfig_uses_default_protocolVersion.js b/jstests/replsets/reconfig_uses_default_protocolVersion.js
new file mode 100644
index 00000000000..706872b9522
--- /dev/null
+++ b/jstests/replsets/reconfig_uses_default_protocolVersion.js
@@ -0,0 +1,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();
+})(); \ No newline at end of file