Commit 3427d99e authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[gitlab1] shell tests for kea-netconf implemented.

parent 1740704a
# Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Path to the temporary configuration file.
CFG_FILE=@abs_top_builddir@/src/bin/netconf/tests/test_config.json
# Path to the Kea log file.
LOG_FILE=@abs_top_builddir@/src/bin/netconf/tests/test.log
# Path to the Kea lease file.
# Expected version
EXPECTED_VERSION="@PACKAGE_VERSION@"
# Kea-netconf configuration to be stored in the configuration file.
CONFIG="{
\"Netconf\":
{
// some configuration will be stored here eventually.
},
\"Logging\":
{
\"loggers\": [
{
\"name\": \"kea-netconf\",
\"output_options\": [
{
\"output\": \"$LOG_FILE\"
}
],
\"severity\": \"INFO\"
}
]
}
}"
# Set the location of the executable.
bin="kea-netconf"
bin_path=@abs_top_builddir@/src/bin/netconf
# Import common test library.
. @abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh
# This test verifies that help can be printed out.
usage_test() {
local TESTNAME="${1}"
local PARAMS="${2}"
local EXP_CODE="${3}"
# Log the start of the test and print test name.
test_start $TESTNAME
# Remove dangling Kea instances and remove log files.
cleanup
# Create correct configuration file.
create_config "${CONFIG}"
# Check it
printf "Running command %s.\n" "\"${bin_path}/${bin} -t ${CFG_FILE}\""
${bin_path}/${bin} ${PARAMS}
exit_code=$?
if [ ${exit_code} -ne $EXP_CODE ]; then
printf "ERROR: expected exit code ${EXP_CODE}, got ${exit_code}\n"
clean_exit 1
fi
test_finish 0
}
version_test "netconf.version"
usage_test "netconf.invalid-param" "-f" 1
usage_test "netconf.dash-h" "-h" 1
usage_test "netconf.dash-v" "-v" 0
# The following tests are currently disabled. Once we have a parser that is
# able to understand logger configuration, those tests (imported from DHCPv4)
# should work.
#shutdown_test "netconf.sigterm_test" 15
#shutdown_test "netconf.sigint_test" 2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment