Fix race in test_handler_poll_session_expired

It's possible that we could test the internal request_handlers
data structure after the exception, but BEFORE it has been modified.
Just wait for it to go to zero length.

Change-Id: I364b1f347553a3f6710a516461c4f097d0276794
This commit is contained in:
David Shrewsbury 2019-04-05 13:03:13 -04:00
parent 1fe6743823
commit 133da674fe
1 changed files with 8 additions and 2 deletions

View File

@ -1760,8 +1760,14 @@ class TestLauncher(tests.DBTestCase):
# time through poll() should handle removing the request handler.
# And our mock side effect should ensure it does not re-enter
# request handling before we check it.
self.assertEqual(0, len(
pool._pool_threads["fake-provider-main"].request_handlers))
for _ in iterate_timeout(10, Exception,
'request_handlers to reach zero count'):
try:
self.assertEqual(0, len(
pool._pool_threads["fake-provider-main"].request_handlers))
break
except AssertionError:
pass
def test_exception_causing_decline_of_paused_request(self):
"""