0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00

SERVER-23084 connect to all mongoses before stopping them in empty_cluster_init.js

This commit is contained in:
Judah Schvimer 2016-03-16 09:57:56 -04:00
parent b531f537cf
commit 0f70440c1d

View File

@ -51,17 +51,23 @@ for (var i = 0; i < 3; i++) {
mongoses.push(mongos); mongoses.push(mongos);
} }
// Eventually connect to a host var connectToMongos = function(host) {
assert.soon(function() { // Eventually connect to a host
try { assert.soon(function() {
mongosConn = new Mongo(mongoses[mongoses.length - 1].host); try {
return true; mongosConn = new Mongo(host);
} catch (e) { return true;
print("Waiting for connect..."); } catch (e) {
printjson(e); print("Waiting for connect to " + host);
return false; printjson(e);
} return false;
}, "Later mongos " + mongoses[mongoses.length - 1].host + " did not start.", 5 * 60 * 1000); }
}, "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 // Shut down our mongoses now that we've tested them
for (var i = 0; i < mongoses.length; i++) { for (var i = 0; i < mongoses.length; i++) {