summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/self_case_insensitive.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/self_case_insensitive.js')
-rw-r--r--jstests/noPassthrough/self_case_insensitive.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/jstests/noPassthrough/self_case_insensitive.js b/jstests/noPassthrough/self_case_insensitive.js
new file mode 100644
index 00000000000..b376b90f83e
--- /dev/null
+++ b/jstests/noPassthrough/self_case_insensitive.js
@@ -0,0 +1,40 @@
+/**
+ * Tests that replSetInitiate and replSetReconfig ignore hostname case.
+ *
+ * @tags: [requires_replication]
+ */
+
+(function() {
+ "use strict";
+
+ const rst = new ReplSetTest({nodes: 2});
+ rst.startSet();
+
+ jsTestLog("replSetInitiate with uppercase hostname");
+
+ let conf = rst.getReplSetConfig();
+ conf.members[0].host = conf.members[0].host.toUpperCase();
+
+ rst.initiate(conf);
+
+ const dbName = "test";
+ const collName = "test";
+ const primary = rst.getPrimary();
+ const testColl = primary.getDB(dbName).getCollection(collName);
+ const doc = {a: 1};
+
+ assert.commandWorked(testColl.insert(doc, {writeConcern: {w: 2}}));
+
+ jsTestLog("replSetReconfig with uppercase hostname");
+
+ let secondary2 = MongoRunner.runMongod({replSet: rst.name});
+ conf = rst.getReplSetConfigFromNode();
+ conf.version++;
+ conf.members.push({_id: 5, host: secondary2.host.toUpperCase()});
+ assert.commandWorked(primary.getDB("admin").runCommand({replSetReconfig: conf}));
+ assert.commandWorked(testColl.insert(doc, {writeConcern: {w: 2}}));
+ assert.commandWorked(testColl.insert(doc, {writeConcern: {w: 3}}));
+
+ MongoRunner.stopMongod(secondary2);
+ rst.stopSet();
+})();