PYTHON-3988 Python Test Suite still uses legacy isMaster Command when… (#1395)

This commit is contained in:
Noah Stapp 2023-10-17 10:55:18 -07:00 committed by GitHub
parent 4fa6056e72
commit 015073d4c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -307,7 +307,10 @@ class ClientContext:
@property
def hello(self):
if not self._hello:
self._hello = self.client.admin.command(HelloCompat.LEGACY_CMD)
if self.serverless or self.load_balancer:
self._hello = self.client.admin.command(HelloCompat.CMD)
else:
self._hello = self.client.admin.command(HelloCompat.LEGACY_CMD)
return self._hello
def _connect(self, host, port, **kwargs):
@ -317,7 +320,7 @@ class ClientContext:
)
try:
try:
client.admin.command(HelloCompat.LEGACY_CMD) # Can we connect?
client.admin.command("ping") # Can we connect?
except pymongo.errors.OperationFailure as exc:
# SERVER-32063
self.connection_attempts.append(