]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1914] Fixed unstable HA tests
authorMarcin Siodelski <marcin@isc.org>
Fri, 26 Apr 2024 07:10:40 +0000 (09:10 +0200)
committerMarcin Siodelski <marcin@isc.org>
Fri, 26 Apr 2024 07:10:40 +0000 (09:10 +0200)
src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc
src/hooks/dhcp/high_availability/tests/ha_test.cc

index 611b6351cb4954a27f57447cf79dced8331a9a6e..5688a95848f806bd6fd2282ccf9c5f96ca9f1786 100644 (file)
@@ -1487,7 +1487,7 @@ public:
     void testSendUpdatesControlResultConflict() {
         // Instruct the server 2 to return an error as a result of receiving a command.
         factory2_->getResponseCreator()->setControlResult(CONTROL_RESULT_CONFLICT);
-        factory3_->getResponseCreator()->setControlResult(CONTROL_RESULT_CONFLICT);
+        factory3_->getResponseCreator()->setControlResult(CONTROL_RESULT_SUCCESS);
 
         // Start HTTP servers.
         ASSERT_NO_THROW({
@@ -1966,6 +1966,7 @@ public:
         // Change the active server's response to success. The initially rejected
         // lease update should no longer be tracked.
         factory2_->getResponseCreator()->setControlResult(CONTROL_RESULT_SUCCESS);
+        factory3_->getResponseCreator()->setControlResult(CONTROL_RESULT_SUCCESS);
 
         bool unpark_called = false;
         testSendLeaseUpdates6([&unpark_called] {
index 92e95bee1ce67b28677d423b74489c02ffcbe2ca..cf762f0722e9d799c7ae5e8370f0cf50580c33fd 100644 (file)
@@ -99,6 +99,12 @@ HATest::runIOService(long ms, std::function<bool()> stop_condition) {
     }
 
     timer_->cancel();
+
+    try {
+        // Run any outstanding handlers and protect against uncaught exceptions.
+        io_service_->poll();
+    } catch (...) {
+    }
 }
 
 boost::shared_ptr<std::thread>