summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/drop_connections_sharded.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/drop_connections_sharded.js')
-rw-r--r--jstests/noPassthrough/drop_connections_sharded.js90
1 files changed, 45 insertions, 45 deletions
diff --git a/jstests/noPassthrough/drop_connections_sharded.js b/jstests/noPassthrough/drop_connections_sharded.js
index 7d2f605946e..205992b2dfc 100644
--- a/jstests/noPassthrough/drop_connections_sharded.js
+++ b/jstests/noPassthrough/drop_connections_sharded.js
@@ -4,49 +4,49 @@
*/
(function() {
- "use strict";
-
- const st = new ShardingTest({
- config: {nodes: 1},
- shards: 1,
- rs0: {nodes: 3},
- mongos: 1,
- });
- const mongos = st.s0;
- const rst = st.rs0;
- const primary = rst.getPrimary();
-
- mongos.adminCommand({multicast: {ping: 0}});
-
- function getConnPoolHosts() {
- const ret = mongos.adminCommand({connPoolStats: 1});
- assert.commandWorked(ret);
- jsTestLog("Connection pool stats by host: " + tojson(ret.hosts));
- return ret.hosts;
- }
-
- const cfg = primary.getDB('local').system.replset.findOne();
- const memberHost = cfg.members[2].host;
- assert.eq(memberHost in getConnPoolHosts(), true);
-
- const removedMember = cfg.members.splice(2, 1);
- assert.eq(removedMember[0].host, memberHost);
- cfg.version++;
-
- jsTestLog("Reconfiguring to omit " + memberHost);
- assert.commandWorked(primary.adminCommand({replSetReconfig: cfg}));
- assert.eq(memberHost in getConnPoolHosts(), true);
-
- jsTestLog("Dropping connections to " + memberHost);
- assert.commandWorked(mongos.adminCommand({dropConnections: 1, hostAndPort: [memberHost]}));
- assert.soon(() => {
- return !(memberHost in getConnPoolHosts());
- });
-
- // need to re-add removed node or test complain about the replset config
- cfg.members.push(removedMember[0]);
- cfg.version++;
- assert.commandWorked(primary.adminCommand({replSetReconfig: cfg}));
-
- st.stop();
+"use strict";
+
+const st = new ShardingTest({
+ config: {nodes: 1},
+ shards: 1,
+ rs0: {nodes: 3},
+ mongos: 1,
+});
+const mongos = st.s0;
+const rst = st.rs0;
+const primary = rst.getPrimary();
+
+mongos.adminCommand({multicast: {ping: 0}});
+
+function getConnPoolHosts() {
+ const ret = mongos.adminCommand({connPoolStats: 1});
+ assert.commandWorked(ret);
+ jsTestLog("Connection pool stats by host: " + tojson(ret.hosts));
+ return ret.hosts;
+}
+
+const cfg = primary.getDB('local').system.replset.findOne();
+const memberHost = cfg.members[2].host;
+assert.eq(memberHost in getConnPoolHosts(), true);
+
+const removedMember = cfg.members.splice(2, 1);
+assert.eq(removedMember[0].host, memberHost);
+cfg.version++;
+
+jsTestLog("Reconfiguring to omit " + memberHost);
+assert.commandWorked(primary.adminCommand({replSetReconfig: cfg}));
+assert.eq(memberHost in getConnPoolHosts(), true);
+
+jsTestLog("Dropping connections to " + memberHost);
+assert.commandWorked(mongos.adminCommand({dropConnections: 1, hostAndPort: [memberHost]}));
+assert.soon(() => {
+ return !(memberHost in getConnPoolHosts());
+});
+
+// need to re-add removed node or test complain about the replset config
+cfg.members.push(removedMember[0]);
+cfg.version++;
+assert.commandWorked(primary.adminCommand({replSetReconfig: cfg}));
+
+st.stop();
})();