diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-06-27 22:57:52 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-06-27 22:57:52 -0400 |
commit | 5f5b56d646f154ee572c9de80449423304103bad (patch) | |
tree | e3b3d1817b5cf489b77db7cfc2c70e371b1e9fa8 | |
parent | 021994685b55c0bca0d50c163ff5f9e9441fc037 (diff) | |
download | sqlalchemy-5f5b56d646f154ee572c9de80449423304103bad.tar.gz |
Add an extra step to pool test_sync
Have observed CI failure with windows where not all
three connections got pulled out at the same time here
as the threads got serialized. make sure all three
connections get used.
Change-Id: Ic2f7c7de1069358d95035f90c725c7dddd4f34d4
-rw-r--r-- | test/engine/test_pool.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py index 370536ce9..278a6cada 100644 --- a/test/engine/test_pool.py +++ b/test/engine/test_pool.py @@ -699,6 +699,13 @@ class PoolFirstConnectSyncTest(PoolTestBase): time.sleep(0.02) threads = [] + + # what we're trying to do here is have concurrent use of + # all three pooled connections at once, and the thing we want + # to test is that first_connect() finishes completely before + # any of the connections get returned. so first_connect() + # sleeps for one second, then pings the mock. the threads should + # not have made it to the "checkout() event for that one second. for i in range(5): th = threading.Thread(target=checkout) th.start() @@ -706,6 +713,15 @@ class PoolFirstConnectSyncTest(PoolTestBase): for th in threads: th.join(join_timeout) + # there is a very unlikely condition observed in CI on windows + # where even though we have five threads above all calling upon the + # pool, we didn't get concurrent use of all three connections, two + # connections were enough. so here we purposely just check out + # all three at once just to get a consistent test result. + make_sure_all_three_are_connected = [pool.connect() for i in range(3)] + for conn in make_sure_all_three_are_connected: + conn.close() + eq_( evt.mock_calls, [ |