remove_if_exists \
"${config_file-}" \
"${csv-}" \
- "${csv_2-}" \
- "${KEA_LOCKFILE_DIR-}" \
- "${KEA_PIDFILE_DIR-}"
+ "${csv_2-}"
}
# Print location of CSV file. Accepts 4 or 6 as parameter.
clean_up
clean_exit 1
fi
- mkdir -p "${KEA_LOCKFILE_DIR}"
- mkdir -p "${KEA_PIDFILE_DIR}"
start_kea_dhcp "${v}"
# This assumes that the CSV creation + writing to CSV is atomic. Not
# sure if it is, but if this ever fails on the comparison further below,
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create correct configuration file.
create_config "${config}"
# Check it
signum=${2} # Signal number
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling D2 instances and remove log files.
- cleanup
# Create new configuration file.
create_config "${CONFIG}"
# Instruct Control Agent to log to the specific file.
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create correct configuration file.
create_config "${config}"
# Check it
dynamic_reconfiguration_test() {
# Log the start of the test and print test name.
test_start "dhcp_ddns.dynamic_reconfiguration"
- # Remove dangling D2 instances and remove log files.
- cleanup
# Create new configuration file.
create_config "${CONFIG}"
# Instruct D2 to log to the specific file.
local signum=${2} # Signal number
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling D2 instances and remove log files.
- cleanup
# Create new configuration file.
create_config "${CONFIG}"
# Instruct D2 to log to the specific file.
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create correct configuration file.
create_config "${config}"
# Check it
dynamic_reconfiguration_test() {
# Log the start of the test and print test name.
test_start "dhcpv4_srv.dynamic_reconfiguration"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create new configuration file.
create_config "${CONFIG}"
# Instruct Kea to log to the specific file.
signum=${2} # Signal number
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create new configuration file.
create_config "${CONFIG}"
# Instruct Kea to log to the specific file.
lfc_timer_test() {
# Log the start of the test and print test name.
test_start "dhcpv4_srv.lfc_timer_test"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create a configuration with the LFC enabled, by replacing the section
# with the lfc-interval and persist parameters.
LFC_CONFIG=$(printf '%s' "${CONFIG}" | sed -e 's/\"lfc-interval\": 0/\"lfc-interval\": 3/g' \
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create correct configuration file.
create_config "${config}"
# Check it
dynamic_reconfiguration_test() {
# Log the start of the test and print test name.
test_start "dhcpv6_srv.dynamic_reconfiguration"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create new configuration file.
create_config "${CONFIG}"
# Instruct Kea to log to the specific file.
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create new configuration file.
create_config "${CONFIG}"
# Instruct Kea to log to the specific file.
lfc_timer_test() {
# Log the start of the test and print test name.
test_start "dhcpv6_srv.lfc_timer_test"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create a configuration with the LFC enabled, by replacing the section
# with the lfc-interval and persist parameters.
LFC_CONFIG=$(printf '%s' "${CONFIG}" | sed -e 's/\"lfc-interval\": 0/\"lfc-interval\": 3/g' \
kea_dhcp_ddns_config_file=${D2_CFG_FILE}\n\
kea_ctrl_agent_config_file=${CA_CFG_FILE}\n\
kea_netconf_config_file=${NC_CFG_FILE}"
+KEACTRL_BUILD_DIR="@abs_top_builddir@"
# A name of the keactrl config file
KEACTRL_CFG_FILE="@abs_top_builddir@/src/bin/keactrl/tests/keactrl_test.conf"
# Path to the Kea log file.
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create correct configuration file.
create_config "${CONFIG}"
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Check it
printf "Running command %s.\n" "\"${bin_path}/${bin}\""
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create correct configuration file.
create_config "${config}"
# Check it
signum=${2} # Signal number
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Netconf instances and remove log files.
- cleanup
# Create new configuration file.
create_config "${CONFIG}"
# Instruct Netconf Agent to log to the specific file.
SUBDIRS = .
+# Needed by shell_unittest.py to access python modules like kea_conn.
+TESTS_ENVIRONMENT = PYTHONPATH="$(abs_top_srcdir)/src/bin/shell"
+
# Python tests
PYTESTS = shell_unittest.py
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove any dangling CA instances and remove log files.
- cleanup
-
# Create new configuration file.
create_config "${CONFIG}"
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove any dangling CA instances and remove log files.
- cleanup
-
# Create new configuration file.
create_config "${CONFIG}"
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
-
REPORTED_VERSION=$(${shell_bin_path}/${shell_bin} -v)
if test "${REPORTED_VERSION}" = "${EXPECTED_VERSION}"; then
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
-
# Create correct configuration file.
create_config "${config}"
# Announce test start.
printf "${green-}[ RUN ]${reset-} %s\n" "${TEST_NAME}"
- # Reset variables that are used in error reporting.
- ERROR=
- OUTPUT=
+ # Remove dangling Kea instances and remove log files.
+ cleanup
+
+ # Make sure lockfile and pidfile directories exist. They are used in some
+ # tests.
+ mkdir -p "${KEA_LOCKFILE_DIR}"
+ # There are certain tests that intentionally run without a KEA_PIDFILE_DIR
+ # e.g. keactrl.status_test. Only create the directory if we test requires
+ # one.
+ if test -n "${KEA_PIDFILE_DIR+x}"; then
+ mkdir -p "${KEA_PIDFILE_DIR}"
+ fi
# Start timer in milliseconds.
START_TIME=$(get_current_time)
report_test_result_in_xml "${TEST_NAME}" "${exit_code}" "${duration}"
if [ "${exit_code}" -eq 0 ]; then
- cleanup
printf "${green-}[ OK ]${reset-} %s\n" "${TEST_NAME}"
else
# Dump log file for debugging purposes if specified and exists.
printf 'Log file dump:\n'
cat "${LOG_FILE}"
fi
- cleanup
printf "${red-}[ FAILED ]${reset-} %s\n" "${TEST_NAME}"
fi
+ # Remove dangling Kea instances and log files.
+ cleanup
+
# Reset traps.
traps_off
local proc_name=${1-} # Process name
local cfg_file_name=${2-} # Configuration file name without extension.
+ # Reset PID results.
+ _GET_PID=0
+ _GET_PIDS_NUM=0
+
# PID file name includes process name. The process name is required.
if [ -z "${proc_name}" ]; then
test_lib_error "get_pid requires process name"
clean_exit 1
fi
+ # There are certain tests that intentionally run without a KEA_PIDFILE_DIR
+ # e.g. keactrl.status_test. We can't get the PID if KEA_PIDFILE_DIR is not
+ # defined. In this case, this function is reporting process not running
+ # (_GET_PID == 0).
+ if test -z "${KEA_PIDFILE_DIR+x}"; then
+ return
+ fi
+
# PID file name includes server configuration file name. For most of
# the tests it is 'test-config' (excluding .json extension). It is
# possible to specify custom name if required.
# Get the absolute location of the PID file for the specified process
# name.
abs_pidfile_path="${KEA_PIDFILE_DIR}/${cfg_file_name}.${proc_name}.pid"
- _GET_PID=0
- _GET_PIDS_NUM=0
# If the PID file exists, get the PID and see if the process is alive.
pid=$(cat "${abs_pidfile_path}" 2> /dev/null || true)
"${DHCP4_CFG_FILE-}" \
"${DHCP6_CFG_FILE-}" \
"${KEACTRL_CFG_FILE-}" \
+ "${KEA_LOCKFILE_DIR-}" \
+ "${KEA_PIDFILE_DIR-}" \
"${NC_CFG_FILE-}"
# Use ${var+x} to test if ${var} is defined.
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
-
# If set to anything other than empty string, reset it to the long version
# parameter.
if test -n "${long_version}"; then
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create bogus configuration file. We don't really want the server to start,
# just want it to log something and die. Empty config is an easy way to
# Log the start of the test and print test name.
test_start "${bin}.server_pid_file_test"
- # Remove dangling DHCP4 instances and remove log files.
- cleanup
# Create new configuration file.
create_config "${CONFIG}"
# Instruct server to log to the specific file.
# Log the start of the test and print test name.
test_start "${test_name}"
- # Remove dangling Kea instances and remove log files.
- cleanup
# Create correct configuration file.
create_config "${config}"
# Instruct Control Agent to log to the specific file.