]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3970] Improved the test for TimerMgr::stopThread.
authorMarcin Siodelski <marcin@isc.org>
Tue, 8 Sep 2015 17:39:52 +0000 (19:39 +0200)
committerMarcin Siodelski <marcin@isc.org>
Tue, 8 Sep 2015 17:39:52 +0000 (19:39 +0200)
This test now also checks that it is possible to skip running
ready handlers.

src/lib/dhcpsrv/tests/timer_mgr_unittest.cc

index 02f52075bb3d4753f8425faa3a9d5a5271a7b723..77148eff548a8be29cdff960921171f409c7a65f 100644 (file)
@@ -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));