From: Marcin Siodelski Date: Fri, 26 Apr 2024 07:10:40 +0000 (+0200) Subject: [#1914] Fixed unstable HA tests X-Git-Tag: Kea-2.5.8~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=857f3f972d60d70216ce0982412740653d4c86c8;p=thirdparty%2Fkea.git [#1914] Fixed unstable HA tests --- diff --git a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc index 611b6351cb..5688a95848 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc @@ -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] { diff --git a/src/hooks/dhcp/high_availability/tests/ha_test.cc b/src/hooks/dhcp/high_availability/tests/ha_test.cc index 92e95bee1c..cf762f0722 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_test.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_test.cc @@ -99,6 +99,12 @@ HATest::runIOService(long ms, std::function stop_condition) { } timer_->cancel(); + + try { + // Run any outstanding handlers and protect against uncaught exceptions. + io_service_->poll(); + } catch (...) { + } } boost::shared_ptr