]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#999] Added new unit test
authorMarcin Siodelski <marcin@isc.org>
Wed, 29 Apr 2020 09:25:26 +0000 (11:25 +0200)
committerMarcin Siodelski <marcin@isc.org>
Fri, 8 May 2020 17:29:09 +0000 (19:29 +0200)
The new unit test verifies that the lease updates are being sent to the
backup server even if the active server is in the partner-down state.

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

index 123531f1dd424edc60d149273def620b85d1d1e6..964a4dc538b1911a1bddd09c468f76c453c740ab 100644 (file)
@@ -4652,6 +4652,17 @@ TEST_F(HAServiceStateMachineTest, shouldSendLeaseUpdatesLoadBalancing) {
     EXPECT_FALSE(expectLeaseUpdates(MyState(HA_WAITING_ST), peer_config));
 }
 
+// Check that lease updates are sent to the backup server even when the
+// secondary is in the partner-down state.
+TEST_F(HAServiceStateMachineTest, shouldSendLeaseUpdatesToBackup) {
+    HAConfigPtr valid_config = createValidConfiguration();
+    valid_config->setWaitBackupAck(false);
+    startService(valid_config);
+
+    // Send the updates to the backup server.
+    HAConfig::PeerConfigPtr backup_config = valid_config->getPeerConfig("server3");
+    EXPECT_TRUE(expectLeaseUpdates(MyState(HA_PARTNER_DOWN_ST), backup_config));
+}
 
 // This test verifies if the server would not send lease updates to the
 // partner if lease updates are administratively disabled.