diff options
author | Judah Schvimer <judah@mongodb.com> | 2016-03-16 09:57:56 -0400 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2016-03-16 09:57:56 -0400 |
commit | 0f70440c1d61ecce39d54fb176cd0280b82d030c (patch) | |
tree | 0acb2956dab06cccc1745c2eacd896b36327d57b /jstests | |
parent | b531f537cf383ec6a70ddbee9f6d2902e7498b96 (diff) | |
download | mongo-0f70440c1d61ecce39d54fb176cd0280b82d030c.tar.gz |
SERVER-23084 connect to all mongoses before stopping them in empty_cluster_init.js
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/sharding/empty_cluster_init.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/jstests/sharding/empty_cluster_init.js b/jstests/sharding/empty_cluster_init.js index dfbc0604fe7..65b1ebeee63 100644 --- a/jstests/sharding/empty_cluster_init.js +++ b/jstests/sharding/empty_cluster_init.js @@ -51,17 +51,23 @@ for (var i = 0; i < 3; i++) { mongoses.push(mongos); } -// Eventually connect to a host -assert.soon(function() { - try { - mongosConn = new Mongo(mongoses[mongoses.length - 1].host); - return true; - } catch (e) { - print("Waiting for connect..."); - printjson(e); - return false; - } -}, "Later mongos " + mongoses[mongoses.length - 1].host + " did not start.", 5 * 60 * 1000); +var connectToMongos = function(host) { + // Eventually connect to a host + assert.soon(function() { + try { + mongosConn = new Mongo(host); + return true; + } catch (e) { + print("Waiting for connect to " + host); + printjson(e); + return false; + } + }, "mongos " + host + " did not start.", 5 * 60 * 1000); +}; + +for (var i = 0; i < mongoses.length; i++) { + connectToMongos(mongoses[i].host); +} // Shut down our mongoses now that we've tested them for (var i = 0; i < mongoses.length; i++) { |