Skip to content

Commit 6b863c7

Browse files
committed
avoid failures when TLS is enabled
1 parent 86d1178 commit 6b863c7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,15 @@ def _connect(self, host, port, **kwargs):
233233
def _init_client(self):
234234
self.client = self._connect(host, port)
235235

236-
build_info = self.client.admin.command('buildInfo')
237-
if 'dataLake' in build_info:
238-
self.data_lake = True
239-
self.auth_enabled = True
240-
self.client = self._connect(
241-
host, port, username=db_user, password=db_pwd)
242-
self.connected = True
243-
return
236+
if self.client is not None:
237+
build_info = self.client.admin.command('buildInfo')
238+
if 'dataLake' in build_info:
239+
self.data_lake = True
240+
self.auth_enabled = True
241+
self.client = self._connect(
242+
host, port, username=db_user, password=db_pwd)
243+
self.connected = True
244+
return
244245

245246
if HAVE_SSL and not self.client:
246247
# Is MongoDB configured for SSL?

0 commit comments

Comments
 (0)