From bb01e08d4457b9ca03c7426e1cda564045439290 Mon Sep 17 00:00:00 2001 From: Kenny Lee Sin Cheong <2530351+kleesc@users.noreply.github.com> Date: Mon, 15 Oct 2018 17:18:11 -0400 Subject: [PATCH] Fix ipresolver test_thread_missing_file (#3268) There is no guarantee that the assertion would happen AFTER "sleep" is called. Block the caller for an amount of time to give "update_ip_thread" time to call "sleep" and raise LoopInterruptionForTest exception to terminate the thread. --- util/ipresolver/test/test_ipresolver.py | 1 + 1 file changed, 1 insertion(+) diff --git a/util/ipresolver/test/test_ipresolver.py b/util/ipresolver/test/test_ipresolver.py index ebd475b52..19e8283a0 100644 --- a/util/ipresolver/test/test_ipresolver.py +++ b/util/ipresolver/test/test_ipresolver.py @@ -64,4 +64,5 @@ def test_thread_missing_file(): with patch('time.sleep', side_effect=LoopInterruptionForTest) as sleep: update_ip_thread = _UpdateIPRange(_UPDATE_INTERVAL) update_ip_thread.start() + update_ip_thread.join(30) sleep.assert_called_with(_FAILED_UPDATE_RETRY_SECS)