summaryrefslogtreecommitdiff
path: root/jstests/replsets/reconfig_ignores_term_field.js
diff options
context:
space:
mode:
authorAli Mir <ali.mir@mongodb.com>2020-02-26 15:00:57 +0000
committerevergreen <evergreen@mongodb.com>2020-02-26 15:00:57 +0000
commit687f9be7fa79ac6f3c2025784f942fdcafeb2a5f (patch)
treefcfb2ffe40332cdb5f7c8a71eb6ba7ddc184f5f6 /jstests/replsets/reconfig_ignores_term_field.js
parent952fa6f3f323e5e6cfb4cf996ed1eef4ae52a9d6 (diff)
downloadmongo-687f9be7fa79ac6f3c2025784f942fdcafeb2a5f.tar.gz
SERVER-46284 Serialize term -1 as a missing field in repl_set_config.cpp
Diffstat (limited to 'jstests/replsets/reconfig_ignores_term_field.js')
-rw-r--r--jstests/replsets/reconfig_ignores_term_field.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/jstests/replsets/reconfig_ignores_term_field.js b/jstests/replsets/reconfig_ignores_term_field.js
index 82971834432..393d87f7592 100644
--- a/jstests/replsets/reconfig_ignores_term_field.js
+++ b/jstests/replsets/reconfig_ignores_term_field.js
@@ -32,14 +32,18 @@ config.term = 55;
config.version++;
assert.commandWorked(primary.getDB("admin").runCommand({replSetReconfig: config, force: true}));
config = primary.getDB("local").system.replset.findOne();
-assert.eq(config.term, -1);
+// Force reconfig sets the config term to -1. During config
+// serialization, a -1 term is treated as a missing field.
+assert(!config.hasOwnProperty("term"));
jsTestLog("Force reconfig with missing term results in term -1");
delete config.term;
config.version++;
assert.commandWorked(primary.getDB("admin").runCommand({replSetReconfig: config, force: true}));
config = primary.getDB("local").system.replset.findOne();
-assert.eq(config.term, -1);
+// Force reconfig sets the config term to -1. During config
+// serialization, a -1 term is treated as a missing field.
+assert(!config.hasOwnProperty("term"));
replTest.stopSet();
}()); \ No newline at end of file