MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_no_wait_queue_timeout

Method test_no_wait_queue_timeout

test/test_pooling.py:340–363  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

338 )
339
340 def test_no_wait_queue_timeout(self):
341 # Verify get_socket() with no wait_queue_timeout blocks forever.
342 pool = self.create_pool(max_pool_size=1)
343 self.addCleanup(pool.close)
344
345 # Reach max_size.
346 with pool.checkout() as s1:
347 t = SocketGetter(self.c, pool)
348 t.start()
349 while t.state != "get_socket":
350 time.sleep(0.1)
351
352 time.sleep(1)
353 self.assertEqual(t.state, "get_socket")
354
355 while t.state != "connection":
356 time.sleep(0.1)
357
358 self.assertEqual(t.state, "connection")
359 self.assertEqual(t.sock, s1)
360 # Cleanup
361 t.release_conn()
362 t.join()
363 pool.close()
364
365 def test_checkout_more_than_max_pool_size(self):
366 pool = self.create_pool(max_pool_size=2)

Callers

nothing calls this directly

Calls 8

release_connMethod · 0.95
addCleanupMethod · 0.80
SocketGetterClass · 0.70
create_poolMethod · 0.45
checkoutMethod · 0.45
startMethod · 0.45
joinMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected