diff options
author | Marcin Siodelski <marcin@isc.org> | 2015-09-08 19:39:52 +0200 |
---|---|---|
committer | Marcin Siodelski <marcin@isc.org> | 2015-09-08 19:39:52 +0200 |
commit | 971b7440bb5dbedaa51dd7893a3d4fb1a690f1a5 (patch) | |
tree | 84a591d894389618cdeff719309b439637ab4619 /src/lib/dhcpsrv/tests/timer_mgr_unittest.cc | |
parent | [3970] Addressed review comments again. (diff) | |
download | kea-971b7440bb5dbedaa51dd7893a3d4fb1a690f1a5.tar.xz kea-971b7440bb5dbedaa51dd7893a3d4fb1a690f1a5.zip |
[3970] Improved the test for TimerMgr::stopThread.
This test now also checks that it is possible to skip running
ready handlers.
Diffstat (limited to 'src/lib/dhcpsrv/tests/timer_mgr_unittest.cc')
-rw-r--r-- | src/lib/dhcpsrv/tests/timer_mgr_unittest.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc index 02f52075bb..77148eff54 100644 --- a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc @@ -446,6 +446,23 @@ TEST_F(TimerMgrTest, stopThreadWithRunningHandlers) { // There should be no calls registered for the timer1. EXPECT_EQ(0, calls_count_["timer1"]); + // Stop the worker thread without completing pending callbacks. + ASSERT_NO_THROW(timer_mgr.stopThread(false)); + + // There should be still not be any calls registered. + EXPECT_EQ(0, calls_count_["timer1"]); + + // We can restart the worker thread before we even kick in the timers. + ASSERT_NO_THROW(timer_mgr.startThread()); + + // Run the thread for 100ms. This should run some timers. The 'false' + // value indicates that the IfaceMgr::receive6 is not called, so the + // watch socket is never cleared. + doWait(100, false); + + // There should be no calls registered for the timer1. + EXPECT_EQ(0, calls_count_["timer1"]); + // Stop the worker thread with completing pending callbacks. ASSERT_NO_THROW(timer_mgr.stopThread(true)); |