]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1402] Trivial changes to HAService tests
authorMarcin Siodelski <marcin@isc.org>
Thu, 7 Jan 2021 12:34:13 +0000 (13:34 +0100)
committerMarcin Siodelski <marcin@isc.org>
Wed, 13 Jan 2021 09:12:32 +0000 (10:12 +0100)
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.

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

index 235c8b32d96bf45bf23e73f329ec8c53d19f2a15..5ccc8ab55d9c325bb0f16b1502fdb6258a7bb285 100644 (file)
@@ -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