Skip to content

Commit 902c1d6

Browse files
committed
Minor fixes to authentication tests.
1 parent a9e85ce commit 902c1d6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/test_auth.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,17 @@ def setUp(self):
128128
raise SkipTest("Auth with sharding requires MongoDB >= 2.0.0")
129129
if not server_started_with_auth(client):
130130
raise SkipTest('Authentication is not enabled on server')
131-
self.set_name = client.admin.command('ismaster').get('setName')
131+
response = client.admin.command('ismaster')
132+
self.set_name = str(response.get('setName', ''))
132133
client.pymongo_test.add_user('user', 'pass')
133134
client.admin.add_user('admin', 'pass')
135+
if self.set_name:
136+
# GLE requires authentication.
137+
client.admin.authenticate('admin', 'pass')
138+
# Make sure the admin user is replicated after calling add_user
139+
# above. This avoids a race in the MRSC tests below. Adding a
140+
# user is just an insert into system.users.
141+
client.admin.command('getLastError', w=len(response['hosts']))
134142
self.client = client
135143

136144
def tearDown(self):

0 commit comments

Comments
 (0)