File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff 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 ):
You can’t perform that action at this time.
0 commit comments