From: Marcin Siodelski Date: Thu, 7 Jan 2021 12:34:13 +0000 (+0100) Subject: [#1402] Trivial changes to HAService tests X-Git-Tag: Kea-1.9.4~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccbe6410d52433f1cbc7b87a690dc0af101d4289;p=thirdparty%2Fkea.git [#1402] Trivial changes to HAService tests For tests which verify the case of communication recovery failure, moved listeners startup into the test part that checks that communication can be re-established, per review comments. --- 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 235c8b32d9..5ccc8ab55d 100644 --- a/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/ha_service_unittest.cc @@ -1115,13 +1115,6 @@ public: /// interruption transitions to the waiting state if the partner refuses delayed /// lease updates. void testSendUpdatesCommunicationRecoveryFailed() { - // Start HTTP servers. - ASSERT_NO_THROW({ - listener_->start(); - listener2_->start(); - listener3_->start(); - }); - // Simulate that the partner returns an error. factory2_->getResponseCreator()->setControlResult(CONTROL_RESULT_ERROR); @@ -1141,6 +1134,13 @@ public: service_->communication_state_->poke(); service_->communication_state_->setPartnerState("load-balancing"); + // Start HTTP servers. + ASSERT_NO_THROW({ + listener_->start(); + listener2_->start(); + listener3_->start(); + }); + // This should cause the server to attempt to send outstanding lease // updates to the partner. The partner reports an error so that should // cause this server to transition to the waiting state from which it @@ -1438,13 +1438,6 @@ public: /// interruption transitions to the waiting state if the partner refuses delayed /// lease updates. void testSendUpdatesCommunicationRecovery6Failed() { - // Start HTTP servers. - ASSERT_NO_THROW({ - listener_->start(); - listener2_->start(); - listener3_->start(); - }); - // Simulate that the partner returns an error. factory2_->getResponseCreator()->setControlResult(CONTROL_RESULT_ERROR); @@ -1464,6 +1457,13 @@ public: service_->communication_state_->poke(); service_->communication_state_->setPartnerState("load-balancing"); + // Start HTTP servers. + ASSERT_NO_THROW({ + listener_->start(); + listener2_->start(); + listener3_->start(); + }); + // This should cause the server to attempt to send outstanding lease // updates to the partner. The partner reports an error so that should // cause this server to transition to the waiting state from which it