PYTHON-3577 Fix test_session_gc on serverless (#1153)

This commit is contained in:
Shane Harvey 2023-02-14 10:18:55 -08:00 committed by GitHub
parent 6ed6c374f1
commit 1797785f99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,8 +122,10 @@ class TestLB(IntegrationTest):
session = client.start_session()
session.start_transaction()
client.test_session_gc.test.find_one({}, session=session)
# Cleanup the transaction left open on the server.
self.addCleanup(self.client.admin.command, "killSessions", [session.session_id])
# Cleanup the transaction left open on the server unless we're
# testing serverless which does not support killSessions.
if not client_context.serverless:
self.addCleanup(self.client.admin.command, "killSessions", [session.session_id])
if client_context.load_balancer:
self.assertEqual(pool.active_sockets, 1) # Pinned.