|
@@ -396,7 +396,13 @@ class TestZonemgrRefresh(unittest.TestCase):
|
|
|
listener.start()
|
|
|
# Sleep 1 sec to ensure that the timer thread has enough time to run.
|
|
|
time.sleep(1)
|
|
|
+ # Shut down the timer thread
|
|
|
self.zone_refresh.shutdown()
|
|
|
+ main_thread = threading.currentThread()
|
|
|
+ for th in threading.enumerate():
|
|
|
+ if th is main_thread:
|
|
|
+ continue
|
|
|
+ th.join()
|
|
|
# After running timer, the zone's state should become "refreshing".
|
|
|
zone_state = self.zone_refresh._zonemgr_refresh_info[ZONE_NAME_CLASS1_IN]["zone_state"]
|
|
|
self.assertTrue("refresh_timeout" in self.zone_refresh._zonemgr_refresh_info[ZONE_NAME_CLASS1_IN].keys())
|
|
@@ -404,12 +410,16 @@ class TestZonemgrRefresh(unittest.TestCase):
|
|
|
|
|
|
def test_shutdown(self):
|
|
|
self.zone_refresh._check_sock = self.zone_refresh._master_socket
|
|
|
- listener = threading.Thread(target=self.zone_refresh.run_timer)
|
|
|
+ listener = threading.Thread(target = self.zone_refresh.run_timer)
|
|
|
listener.start()
|
|
|
self.assertTrue(listener.is_alive())
|
|
|
+ # Shut down the timer thread
|
|
|
self.zone_refresh.shutdown()
|
|
|
- # Sleep 1 sec to ensure that the timer thread has enough time to exit.
|
|
|
- time.sleep(1)
|
|
|
+ main_thread = threading.currentThread()
|
|
|
+ for th in threading.enumerate():
|
|
|
+ if th is main_thread:
|
|
|
+ continue
|
|
|
+ th.join()
|
|
|
self.assertFalse(listener.is_alive())
|
|
|
|
|
|
def tearDown(self):
|