From f1580b1786a01c4e14842c5b097ee42e68659c25 Mon Sep 17 00:00:00 2001 From: Josh Usiskin <56369778+jusiskin@users.noreply.github.com> Date: Wed, 9 Oct 2024 11:25:02 -0500 Subject: [PATCH] test: fix inconsistent test for SUCCEEDED session action logging (#434) Signed-off-by: Josh Usiskin <56369778+jusiskin@users.noreply.github.com> --- test/unit/sessions/test_session.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unit/sessions/test_session.py b/test/unit/sessions/test_session.py index dcdf7b38..5ba445a6 100644 --- a/test/unit/sessions/test_session.py +++ b/test/unit/sessions/test_session.py @@ -1593,6 +1593,10 @@ def test_logs_succeeded( action_status=success_action_status, now=action_complete_time, ) + # This because the _action_update_impl submits a future to this thread pool executor + # The test assertion depends on this future completing and so there's a race condition + # if we do not wait for the thread pool to shutdown and all futures to complete. + session._executor.shutdown() # THEN mock_mod_logger.info.assert_called_once()