From 306636e64dc884484aad772dd6994299d30c2a06 Mon Sep 17 00:00:00 2001 From: Hong Hui Xiao Date: Tue, 24 Nov 2015 09:01:48 -0500 Subject: [PATCH] Wait for the watch process in test case Because the _watch_process and the failing_process are asynchronous, there might be a chance that failing_process exit and _watch_process is not executed. If the _watch_process is blocked, the method that will be asserted will not be called. This will fail the UT, but it is intermittent. Change-Id: Ic951c1b91c5a10462f548544a5e8d482c52ad665 Closes-Bug: #1519160 Related-Bug: #1543040 Related Bug: #1506021 (cherry picked from commit dcd0498c17ae860c55a92f9f31b3e3fa0460b78e) --- neutron/tests/unit/agent/linux/test_async_process.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neutron/tests/unit/agent/linux/test_async_process.py b/neutron/tests/unit/agent/linux/test_async_process.py index 6e72061723f..43ae302a27c 100644 --- a/neutron/tests/unit/agent/linux/test_async_process.py +++ b/neutron/tests/unit/agent/linux/test_async_process.py @@ -291,4 +291,7 @@ class TestFailingAsyncProcess(base.BaseTestCase): as handle_error_mock: self.process.start() self.process._process.wait() + # Wait for the monitor process to complete + for thread in self.process._watchers: + thread.wait() self.assertEqual(1, handle_error_mock.call_count)