From: Razvan Becheriu Date: Sat, 23 Jan 2021 19:05:07 +0000 (+0200) Subject: [#1627] fixed surious failure of unittest X-Git-Tag: Kea-1.9.4~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa9dc1662ee3a2913a141832f5bd5cc9720cf279;p=thirdparty%2Fkea.git [#1627] fixed surious failure of unittest * the unittest waitingSyncingReadyLoadBalancing spurious failure was fixed by adding state_->stopHeartbeat() call before calling partner.enableRespondLeaseFetching() --- diff --git a/src/hooks/dhcp/high_availability/ha_service.cc b/src/hooks/dhcp/high_availability/ha_service.cc index 11309df3ea..6f64a4cf09 100644 --- a/src/hooks/dhcp/high_availability/ha_service.cc +++ b/src/hooks/dhcp/high_availability/ha_service.cc @@ -666,7 +666,7 @@ HAService::syncingStateHandler() { config_->getFailoverPeerConfig()->getName(), dhcp_disable_timeout); - // If the leases synchronization was successful, let's transition + // If the leases synchronization was successful, let's transition // to the ready state. if (sync_status == CONTROL_RESULT_SUCCESS) { verboseTransition(HA_READY_ST); 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 6743438faa..e2f0d1c549 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc @@ -5450,10 +5450,15 @@ TEST_F(HAServiceStateMachineTest, waitingSyncingReadyLoadBalancing) { service_->runModel(HAService::NOP_EVT); EXPECT_EQ(HA_SYNCING_ST, service_->getCurrState()); + // We better stop the heartbeat to not interfere with the synchronous + // commands. + state_->stopHeartbeat(); + // Enable the partner to correctly respond to the lease fetching and retry. // We should successfully update the database and transition. // SYNCING ---> READY partner.enableRespondLeaseFetching(); + // After previous attempt to synchronize the recorded partner state became // "unavailable". This server won't synchronize until the heartbeat is // sent which would indicate that the server is running. Therefore, we