summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@10gen.com>2018-03-08 16:35:32 -0500
committerRobert Guo <robert.guo@10gen.com>2018-03-12 12:24:04 -0400
commit2ecda906b90007568f3ccbbfda06f1bcde689eee (patch)
treefde1dea287165e14be346446fe0756003a7dd56d /src
parent88a553287ab648d66e5ec96b328c6c1bbd88cc34 (diff)
downloadmongo-2ecda906b90007568f3ccbbfda06f1bcde689eee.tar.gz
SERVER-33751 Allow connecting to an existing cluster in ReplSetTest
Diffstat (limited to 'src')
-rw-r--r--src/mongo/shell/replsettest.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js
index 08f058425a7..20b7734adeb 100644
--- a/src/mongo/shell/replsettest.js
+++ b/src/mongo/shell/replsettest.js
@@ -1333,7 +1333,15 @@ var ReplSetTest = function(opts) {
* Constructor, which instantiates the ReplSetTest object from an existing set.
*/
function _constructFromExistingSeedNode(seedNode) {
- var conf = _replSetGetConfig(new Mongo(seedNode));
+ const conn = new Mongo(seedNode);
+ var conf;
+ if (jsTest.options().keyFile) {
+ self.keyFile = jsTest.options().keyFile;
+ conf = authutil.asCluster(conn, self.keyFile, () => _replSetGetConfig(conn));
+ } else {
+ conf = _replSetGetConfig(conn);
+ }
+
print('Recreating replica set from config ' + tojson(conf));
var existingNodes = conf.members.map(member => member.host);