]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#4630] disable netconf in test if not present
authorMarcin Godzina <mgodzina@isc.org>
Thu, 9 Jul 2026 07:31:20 +0000 (09:31 +0200)
committerMarcin Godzina <mgodzina@isc.org>
Thu, 9 Jul 2026 07:34:37 +0000 (09:34 +0200)
src/bin/keactrl/tests/keactrl_tests.sh.in

index ca0d24242f35c399a078a935c15018ba301c4c66..dac42232e6ddbd2f4d83cc9c84c93dab744783cb 100755 (executable)
@@ -1446,8 +1446,13 @@ server_options_tests() {
 
     # Create configuration file for keactrl. This configuration enables
     # kea-dhcp4, kea-dhcp6, kea-dhcp-ddns and kea-netconf.
-    keactrl_config="${CFG_FILES}\ndhcp4=yes\ndhcp6=yes\n\
-dhcp_ddns=yes\nnetconf=yes\n\
+    keactrl_config="${CFG_FILES}\ndhcp4=yes\ndhcp6=yes\ndhcp_ddns=yes\n"
+    if ${have_netconf}; then
+        keactrl_config="${keactrl_config}netconf=yes\n"
+    else
+        keactrl_config="${keactrl_config}netconf=no\n"
+    fi
+    keactrl_config="${keactrl_config}\
 kea_verbose=no\n\
 dhcp4_cli_options=\"-F\"\n\
 dhcp6_cli_options=\"-F\"\n\
@@ -1465,10 +1470,10 @@ netconf_cli_options=\"-F\"\n${keactrl_fixed_config}"
     set_logger
 
     # Start servers using keactrl script.
-    printf 'INFO/test_lib: Starting Kea: %s start -c %s -s dhcp4,dhcp6,dhcp_ddns,netconf\n' \
+    printf 'INFO/test_lib: Starting Kea: %s start -c %s\n' \
            "${keactrl}" "${KEACTRL_CFG_FILE}"
     set +e
-    "${keactrl}" start -c "${KEACTRL_CFG_FILE}" -s dhcp4,dhcp6,dhcp_ddns,netconf
+    "${keactrl}" start -c "${KEACTRL_CFG_FILE}"
     assert_eq 0 "${?}" "Expected keactrl to return %d, returned value was %d"
     set -e
 
@@ -1522,15 +1527,17 @@ Expected wait_for_message return %d, returned %d."
     fi
 
     # kea-netconf server
-    get_pid "${netconf_name}" "${NC_CFG_FILE_NAME}"
-    assert_eq 1 "${_GET_PIDS_NUM}" \
-        "ERROR: Expected %d ${netconf_name} process running, found %d processes running"
-
-    NETCONF_CMDLINE="$(ps -p "${_GET_PID}" -o args=)"
-    if ! echo "${NETCONF_CMDLINE}" | grep -q -- ' -F'; then
-        printf "ERROR: kea-netconf did not start with expected -F argument.\n"
-        shutdown_servers
-        test_finish 1
+    if ${have_netconf}; then
+        get_pid "${netconf_name}" "${NC_CFG_FILE_NAME}"
+        assert_eq 1 "${_GET_PIDS_NUM}" \
+            "ERROR: Expected %d ${netconf_name} process running, found %d processes running"
+
+        NETCONF_CMDLINE="$(ps -p "${_GET_PID}" -o args=)"
+        if ! echo "${NETCONF_CMDLINE}" | grep -q -- ' -F'; then
+            printf "ERROR: kea-netconf did not start with expected -F argument.\n"
+            shutdown_servers
+            test_finish 1
+        fi
     fi
 
     shutdown_servers
@@ -1541,8 +1548,13 @@ Expected wait_for_message return %d, returned %d."
 
     # Create configuration file for keactrl. This configuration enables
     # kea-dhcp4, kea-dhcp6, kea-dhcp-ddns and kea-netconf.
-    keactrl_config="${CFG_FILES}\ndhcp4=yes\ndhcp6=yes\n\
-dhcp_ddns=yes\nnetconf=yes\n\
+    keactrl_config="${CFG_FILES}\ndhcp4=yes\ndhcp6=yes\ndhcp_ddns=yes\n"
+    if ${have_netconf}; then
+        keactrl_config="${keactrl_config}netconf=yes\n"
+    else
+        keactrl_config="${keactrl_config}netconf=no\n"
+    fi
+    keactrl_config="${keactrl_config}\
 kea_verbose=no\n\
 dhcp4_cli_options=\"-F\"\n\
 dhcp6_cli_options=\"-F\"\n\
@@ -1560,10 +1572,10 @@ netconf_cli_options=\"-F\"\n${keactrl_fixed_config}"
     set_logger
 
     # Start servers using keactrl script.
-    printf 'INFO/test_lib: Starting Kea: %s start -c %s -s dhcp4,dhcp6,dhcp_ddns,netconf -- -X\n' \
+    printf 'INFO/test_lib: Starting Kea: %s start -c %s -- -X\n' \
            "${keactrl}" "${KEACTRL_CFG_FILE}"
     set +e
-    "${keactrl}" start -c "${KEACTRL_CFG_FILE}" -s dhcp4,dhcp6,dhcp_ddns,netconf -- -X
+    "${keactrl}" start -c "${KEACTRL_CFG_FILE}" -- -X
     assert_eq 0 "${?}" "Expected keactrl to return %d, returned value was %d"
     set -e
 
@@ -1617,15 +1629,17 @@ Expected wait_for_message return %d, returned %d."
     fi
 
     # kea-netconf server
-    get_pid "${netconf_name}" "${NC_CFG_FILE_NAME}"
-    assert_eq 1 "${_GET_PIDS_NUM}" \
-        "ERROR: Expected %d ${netconf_name} process running, found %d processes running"
-
-    NETCONF_CMDLINE="$(ps -p "${_GET_PID}" -o args=)"
-    if ! echo "${NETCONF_CMDLINE}" | grep -q -- ' -X -F'; then
-        printf "ERROR: kea-netconf did not start with expected -X -F argument.\n"
-        shutdown_servers
-        test_finish 1
+    if ${have_netconf}; then
+        get_pid "${netconf_name}" "${NC_CFG_FILE_NAME}"
+        assert_eq 1 "${_GET_PIDS_NUM}" \
+            "ERROR: Expected %d ${netconf_name} process running, found %d processes running"
+
+        NETCONF_CMDLINE="$(ps -p "${_GET_PID}" -o args=)"
+        if ! echo "${NETCONF_CMDLINE}" | grep -q -- ' -X -F'; then
+            printf "ERROR: kea-netconf did not start with expected -X -F argument.\n"
+            shutdown_servers
+            test_finish 1
+        fi
     fi
 
     shutdown_servers