From 5a76da986da7166226cc3da2eed081bc5263bfe6 Mon Sep 17 00:00:00 2001 From: Ben Caimano Date: Wed, 17 Feb 2021 17:42:20 +0000 Subject: SERVER-54136 Make the authenticate command respect enforceUserClusterSeparation --- src/mongo/shell/shardingtest.js | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src/mongo/shell') diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 2087653e897..d19ed6bdad9 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -393,6 +393,27 @@ var ShardingTest = function(params) { } }; + this.stopAllConfigServers = function(opts) { + if (this.configRS) { + this.configRS.stopSet(undefined, undefined, opts); + } else { + // Old style config triplet + for (var i = 0; i < this._configServers.length; i++) { + this.stopConfigServer(i, opts); + } + } + }; + + this.stopAllShards = function(opts) { + for (var i = 0; i < this._connections.length; i++) { + if (this._rs[i]) { + this._rs[i].test.stopSet(15, undefined, opts); + } else { + this.stopMongod(i, opts); + } + } + }; + this.stopAllMongos = function(opts) { for (var i = 0; i < this._mongos.length; i++) { this.stopMongos(i, opts); @@ -415,25 +436,11 @@ var ShardingTest = function(params) { this.stopAllMongos(opts); let startTime = new Date(); // Measure the execution time of shutting down shards. - for (var i = 0; i < this._connections.length; i++) { - if (this._rs[i]) { - this._rs[i].test.stopSet(15, undefined, opts); - } else { - this.stopMongod(i, opts); - } - } + this.stopAllShards(opts); print("ShardingTest stopped all shards, took " + (new Date() - startTime) + "ms for " + this._connections.length + " shards."); - if (this.configRS) { - this.configRS.stopSet(undefined, undefined, opts); - } else { - // Old style config triplet - for (var i = 0; i < this._configServers.length; i++) { - this.stopConfigServer(i, opts); - } - } - + this.stopAllConfigServers(opts); if (!opts.noCleanData) { print("ShardingTest stop deleting all dbpaths"); for (var i = 0; i < _alldbpaths.length; i++) { -- cgit v1.2.1