Skip to content

Commit

Permalink
Fix rueckstiess#476: Error while creating replica set with name and a…
Browse files Browse the repository at this point in the history
…uth args

   * index value for config_docs is now taken from args
   * Add simple test for --name parameter
  • Loading branch information
Krzysztof Grzempa authored and stephentunney committed Nov 22, 2017
1 parent f060c23 commit 9e9350d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mtools/mlaunch/mlaunch.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1387,8 +1387,8 @@ def _get_processes(self):

def _wait_for_primary(self):

hosts = [x['host'] for x in self.config_docs['replset']['members']]
rs_name = self.config_docs['replset']['_id']
hosts = [x['host'] for x in self.config_docs[self.args['name']]['members']]
rs_name = self.config_docs[self.args['name']]['_id']
mrsc = self.client(hosts, replicaSet=rs_name,
serverSelectionTimeoutMS=30000)

Expand Down
15 changes: 14 additions & 1 deletion mtools/test/test_mlaunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,21 @@ def test_repeat_all_with_auth(self):

self.use_auth = False

@attr('auth')
def test_replicaset_with_name(self):
""" mlaunch: test calling init on the replica set with given name """

self.run_tool("init --replicaset --name testrs")

# create mongo client for the next tests
mc = MongoClient('localhost:%i' % self.port)

# get rs.conf() and check for its name
conf = mc['local']['system.replset'].find_one()
assert conf['_id'] == 'testrs'

# TODO
# - test functionality of --binarypath, --verbose, --name
# - test functionality of --binarypath, --verbose

# All tests that use auth need to be decorated with @attr('auth')

Expand Down

0 comments on commit 9e9350d

Please sign in to comment.