You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
system-tests/testrunner

73 lines
2.1 KiB

#!/bin/bash
set -e
REPORT_DIRECTORY='reports/'
usage() {
printf "Usage: %s <type CE/PRO>\n\n" "$0"
printf "Usage example: %s CE\n" "$0"
}
if [ $# -lt 1 ] ; then
usage >&2
exit 1
fi
TYPE=$(echo "$1"| tr '[:upper:]' '[:lower:]')
case "${TYPE}" in
ce|pro) echo "Requested system tests for supported type '${TYPE}', continue..." ;;
*) echo "ERRRO: Unknown type '$1'" >&2 ; usage >&2 ; exit 1 ;;
esac
if ls /var/cores/core.perl-fcgi.sig11* >/dev/null 2>&1 ; then
echo "================== NOTE: CORE DUMP DETECTED =================="
echo "= Removing known cores to prevent failing for the known issues:"
echo "= 1) MT#21791: Renaming ngcp-panel cores /var/cores/core.perl-fcgi.sig11*"
ls -la /var/cores/core.perl-fcgi.sig11*
for file in /var/cores/core.perl-fcgi.sig11* ; do
mv "${file}" /var/cores/RENAMED_"$(basename "${file}")"
done
echo "= New cores names are:"
ls -la /var/cores/RENAMED_core.perl-fcgi.sig11*
echo "========================== DONE =============================="
fi
goss="goss-0.2.4-linux-amd64"
if [ ! -x "/usr/sbin/${goss}" ] ; then
echo "Downloading goss and installing as /usr/sbin/${goss}"
curl -L "https://deb.sipwise.com/files/${goss}" > "/usr/sbin/${goss}"
chmod +x "/usr/sbin/${goss}"
fi
rm -f /usr/sbin/goss
ln -s "/usr/sbin/${goss}" /usr/sbin/goss
host_yml_file="/etc/ngcp-config/config.$(hostname).yml"
if [ -n "${SKIP_DNS_CHECK_TEST}" ] || [ -n "${SKIP_STRICT_HOSTNAME_TEST}" ] ; then
echo "Configuring host specific YML config: ${host_yml_file}"
cat > "${host_yml_file}" << EOF
---
sipwise:
system_tester:
skip_dns_check_test: ${SKIP_DNS_CHECK_TEST:-false}
skip_strict_hostname_test: ${SKIP_STRICT_HOSTNAME_TEST:-false}
EOF
else
# remove the file if exist from the previous run
rm -f "${host_yml_file}"
fi
echo "Rebuilding test configs in /etc/ngcp-test/"
ngcpcfg build /etc/ngcp-test/*
rm -f "${host_yml_file}"
rm -rf "${REPORT_DIRECTORY}"
mkdir -p "${REPORT_DIRECTORY}"
TAP_RESULTS="${REPORT_DIRECTORY}/goss_${TYPE}_results.tap"
goss -g "/etc/ngcp-tests/${TYPE}/goss.yaml" validate --format tap | tee "${TAP_RESULTS}"
exit "${PIPESTATUS[0]}"