summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/rsm_horizon_change.js
diff options
context:
space:
mode:
authorCheahuychou Mao <cheahuychou.mao@mongodb.com>2020-04-21 13:19:51 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-22 22:30:45 +0000
commit9b84fa238026e733660899545554865208762d8e (patch)
tree52d5040f58b03dc9107a352ac70ea5346d435585 /jstests/noPassthrough/rsm_horizon_change.js
parent39f506463b2a88310ec874330347f1fd3ce07778 (diff)
downloadmongo-9b84fa238026e733660899545554865208762d8e.tar.gz
SERVER-47049 Test split horizon reconfig
Diffstat (limited to 'jstests/noPassthrough/rsm_horizon_change.js')
-rw-r--r--jstests/noPassthrough/rsm_horizon_change.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/jstests/noPassthrough/rsm_horizon_change.js b/jstests/noPassthrough/rsm_horizon_change.js
new file mode 100644
index 00000000000..5ff364277f2
--- /dev/null
+++ b/jstests/noPassthrough/rsm_horizon_change.js
@@ -0,0 +1,35 @@
+/*
+ * Tests that split horizon reconfig results in unknown ServerDescription in
+ * StreamableReplicaSetMonitor.
+ */
+(function() {
+'use strict';
+
+const st = new ShardingTest(
+ {mongos: [{setParameter: {replicaSetMonitorProtocol: "streamable"}}], config: 1, shards: 0});
+const configRSPrimary = st.configRS.getPrimary();
+
+const unknownTopologyChangeRegex = new RegExp(
+ `Topology Change.*${st.configRS.name}.*topologyType:.*ReplicaSetNoPrimary.*type:.*Unknown`);
+const knownTopologyChangeRegex = new RegExp(
+ `Topology Change.*${st.configRS.name}.*topologyType:.*ReplicaSetWithPrimary.*type:.*RSPrimary`);
+
+jsTest.log("Wait until the RSM on the mongos finds out about the config server primary");
+checkLog.contains(st.s, knownTopologyChangeRegex);
+
+jsTest.log("Run split horizon reconfig and verify that it results in unknown server description");
+const rsConfig = configRSPrimary.getDB("local").system.replset.findOne();
+for (let i = 0; i < rsConfig.members.length; i++) {
+ rsConfig.members[i].horizons = {specialHorizon: 'horizon.com:100' + i};
+}
+rsConfig.version++;
+
+assert.commandWorked(st.s.adminCommand({clearLog: 'global'}));
+assert.commandWorked(configRSPrimary.adminCommand({replSetReconfig: rsConfig}));
+
+checkLog.contains(st.s, unknownTopologyChangeRegex);
+
+jsTest.log("Verify that the RSM eventually has the right topology description again");
+checkLog.contains(st.s, knownTopologyChangeRegex);
+st.stop();
+})();