From 1e20778f013d837396109e7ea7a2b20035775727 Mon Sep 17 00:00:00 2001 From: Slawek Figiel Date: Mon, 8 Jul 2024 21:05:09 +0200 Subject: [PATCH] [#1350] Fix system test --- tests/system/config/kea-ha1/hook-ha.json | 30 +++++++++++++++++++ tests/system/config/kea-ha2/hook-ha.json | 30 +++++++++++++++++++ .../ha1}/hook-ha-dhcp4.json | 0 .../ha1}/hook-ha-dhcp6.json | 0 .../ha2}/hook-ha-dhcp4.json | 0 .../ha2}/hook-ha-dhcp6.json | 0 tests/system/docker-compose.yaml | 12 +++++--- tests/system/tests/test_config_review.py | 1 + 8 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 tests/system/config/kea-ha1/hook-ha.json create mode 100644 tests/system/config/kea-ha2/hook-ha.json rename tests/system/config/{kea-ha1 => kea-multi-threading/ha1}/hook-ha-dhcp4.json (100%) rename tests/system/config/{kea-ha1 => kea-multi-threading/ha1}/hook-ha-dhcp6.json (100%) rename tests/system/config/{kea-ha2 => kea-multi-threading/ha2}/hook-ha-dhcp4.json (100%) rename tests/system/config/{kea-ha2 => kea-multi-threading/ha2}/hook-ha-dhcp6.json (100%) diff --git a/tests/system/config/kea-ha1/hook-ha.json b/tests/system/config/kea-ha1/hook-ha.json new file mode 100644 index 000000000..13cb77e99 --- /dev/null +++ b/tests/system/config/kea-ha1/hook-ha.json @@ -0,0 +1,30 @@ +{ + "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_ha.so", + "parameters": { + "high-availability": [ + { + + "this-server-name": "server1", + "mode": "hot-standby", + "heartbeat-delay": 10000, + "max-response-delay": 20000, + "max-ack-delay": 5000, + "max-unacked-clients": 3, + "peers": [ + { + "name": "server1", + "url": "http://172.42.42.100:8000", + "role": "primary", + "auto-failover": true + }, + { + "name": "server2", + "url": "http://172.42.42.101:8000", + "role": "standby", + "auto-failover": true + } + ] + } + ] + } +}, \ No newline at end of file diff --git a/tests/system/config/kea-ha2/hook-ha.json b/tests/system/config/kea-ha2/hook-ha.json new file mode 100644 index 000000000..974ca9613 --- /dev/null +++ b/tests/system/config/kea-ha2/hook-ha.json @@ -0,0 +1,30 @@ +{ + "library": "/usr/lib/x86_64-linux-gnu/kea/hooks/libdhcp_ha.so", + "parameters": { + "high-availability": [ + { + + "this-server-name": "server2", + "mode": "hot-standby", + "heartbeat-delay": 10000, + "max-response-delay": 20000, + "max-ack-delay": 5000, + "max-unacked-clients": 3, + "peers": [ + { + "name": "server1", + "url": "http://172.42.42.100:8000", + "role": "primary", + "auto-failover": true + }, + { + "name": "server2", + "url": "http://172.42.42.101:8000", + "role": "standby", + "auto-failover": true + } + ] + } + ] + } +}, \ No newline at end of file diff --git a/tests/system/config/kea-ha1/hook-ha-dhcp4.json b/tests/system/config/kea-multi-threading/ha1/hook-ha-dhcp4.json similarity index 100% rename from tests/system/config/kea-ha1/hook-ha-dhcp4.json rename to tests/system/config/kea-multi-threading/ha1/hook-ha-dhcp4.json diff --git a/tests/system/config/kea-ha1/hook-ha-dhcp6.json b/tests/system/config/kea-multi-threading/ha1/hook-ha-dhcp6.json similarity index 100% rename from tests/system/config/kea-ha1/hook-ha-dhcp6.json rename to tests/system/config/kea-multi-threading/ha1/hook-ha-dhcp6.json diff --git a/tests/system/config/kea-ha2/hook-ha-dhcp4.json b/tests/system/config/kea-multi-threading/ha2/hook-ha-dhcp4.json similarity index 100% rename from tests/system/config/kea-ha2/hook-ha-dhcp4.json rename to tests/system/config/kea-multi-threading/ha2/hook-ha-dhcp4.json diff --git a/tests/system/config/kea-ha2/hook-ha-dhcp6.json b/tests/system/config/kea-multi-threading/ha2/hook-ha-dhcp6.json similarity index 100% rename from tests/system/config/kea-ha2/hook-ha-dhcp6.json rename to tests/system/config/kea-multi-threading/ha2/hook-ha-dhcp6.json diff --git a/tests/system/docker-compose.yaml b/tests/system/docker-compose.yaml index a14bc7e76..8f6a4e745 100644 --- a/tests/system/docker-compose.yaml +++ b/tests/system/docker-compose.yaml @@ -245,8 +245,8 @@ services: extends: agent-kea hostname: agent-kea-ha1 volumes: - - $PWD/tests/system/config/kea-ha1/hook-ha-dhcp4.json:/etc/kea/hook-ha-dhcp4.json - - $PWD/tests/system/config/kea-ha1/hook-ha-dhcp6.json:/etc/kea/hook-ha-dhcp6.json + - $PWD/tests/system/config/kea-ha1/hook-ha.json:/etc/kea/hook-ha-dhcp4.json + - $PWD/tests/system/config/kea-ha1/hook-ha.json:/etc/kea/hook-ha-dhcp6.json agent-kea-ha1-only-top-mt: extends: agent-kea-ha1 @@ -257,6 +257,8 @@ services: extends: agent-kea-ha1-only-top-mt volumes: - $PWD/tests/system/config/kea-multi-threading/ha-multi-threading.json:/etc/kea/ha-multi-threading.json + - $PWD/tests/system/config/kea-multi-threading/ha1/hook-ha-dhcp4.json:/etc/kea/hook-ha-dhcp4.json + - $PWD/tests/system/config/kea-multi-threading/ha1/hook-ha-dhcp6.json:/etc/kea/hook-ha-dhcp6.json agent-kea-ha2: extends: agent-kea @@ -286,8 +288,8 @@ services: ipv6_address: 3001:db8:1:42::101 priority: 400 volumes: - - $PWD/tests/system/config/kea-ha2/hook-ha-dhcp4.json:/etc/kea/hook-ha-dhcp4.json - - $PWD/tests/system/config/kea-ha2/hook-ha-dhcp6.json:/etc/kea/hook-ha-dhcp6.json + - $PWD/tests/system/config/kea-ha2/hook-ha.json:/etc/kea/hook-ha-dhcp4.json + - $PWD/tests/system/config/kea-ha2/hook-ha.json:/etc/kea/hook-ha-dhcp6.json agent-kea-ha2-only-top-mt: extends: agent-kea-ha2 @@ -298,6 +300,8 @@ services: extends: agent-kea-ha2-only-top-mt volumes: - $PWD/tests/system/config/kea-multi-threading/ha-multi-threading.json:/etc/kea/ha-multi-threading.json + - $PWD/tests/system/config/kea-multi-threading/ha2/hook-ha-dhcp4.json:/etc/kea/hook-ha-dhcp4.json + - $PWD/tests/system/config/kea-multi-threading/ha2/hook-ha-dhcp6.json:/etc/kea/hook-ha-dhcp6.json agent-bind9: restart: always diff --git a/tests/system/tests/test_config_review.py b/tests/system/tests/test_config_review.py index d4485e624..c5f006913 100644 --- a/tests/system/tests/test_config_review.py +++ b/tests/system/tests/test_config_review.py @@ -92,6 +92,7 @@ def test_get_ha_pair_mt_config_review_reports(server_service: Server, ha_pair_se server_service.log_in_as_admin() server_service.authorize_all_machines() states = server_service.wait_for_next_machine_states() + server_service.wait_for_ha_ready() assert len(states) == 2