Skip to content

Commit b95baf2

Browse files
committed
Make test_maxConnecting more useful
1 parent e91d398 commit b95baf2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/test_pooling.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,14 @@ def find_one():
396396

397397
self.assertEqual(len(docs), 50)
398398
self.assertLessEqual(len(pool.sockets), 50)
399+
# TLS and auth make connection establishment more expensive than
400+
# the artificially delayed query which leads to more threads
401+
# hitting maxConnecting. The end result is fewer total connections
402+
# and better latency.
403+
if client_context.tls and client_context.auth_enabled:
404+
self.assertLessEqual(len(pool.sockets), 20)
405+
else:
406+
self.assertLessEqual(len(pool.sockets), 50)
399407
# MongoDB 4.4.1 with auth + ssl:
400408
# maxConnecting = 2: 6 connections in ~0.231+ seconds
401409
# maxConnecting = unbounded: 50 connections in ~0.642+ seconds

0 commit comments

Comments
 (0)