]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1627] fixed surious failure of unittest
authorRazvan Becheriu <razvan@isc.org>
Sat, 23 Jan 2021 19:05:07 +0000 (21:05 +0200)
committerRazvan Becheriu <razvan@isc.org>
Mon, 25 Jan 2021 11:38:21 +0000 (11:38 +0000)
 * the unittest waitingSyncingReadyLoadBalancing spurious failure was
   fixed by adding state_->stopHeartbeat() call before calling
   partner.enableRespondLeaseFetching()

src/hooks/dhcp/high_availability/ha_service.cc
src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc

index 11309df3ea58354a2bcf0673947a4e8f9051ca53..6f64a4cf09ed8a192a5a2efd0ef4dce0f3147fa7 100644 (file)
@@ -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);
index 6743438faabe27f67ea2745b17cbefdfae3f494d..e2f0d1c549fc61c361fbfc3211c20f8cf43cf32a 100644 (file)
@@ -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