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

45 lines
1.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 [ ! -x /usr/sbin/goss ] ; then
echo "Downloading goss and installing as /usr/sbin/goss"
curl -L https://deb.sipwise.com/files/goss-0.0.16-linux-amd64 > /usr/sbin/goss
chmod +x /usr/sbin/goss
fi
echo "Rebuilding test configs in /etc/ngcp-test/"
ngcpcfg build /etc/ngcp-test/*
rm -rf "${REPORT_DIRECTORY}"
mkdir -p "${REPORT_DIRECTORY}"
TAP_RESULTS="${REPORT_DIRECTORY}/goss_${TYPE}_results.tap"
# TODO: add --format=tap when TAP formater will be supported
if goss -g "/etc/ngcp-tests/${TYPE}/goss.json" validate ; then
echo "1..1" > "${TAP_RESULTS}"
echo "ok 1 - no errors were found" >> "${TAP_RESULTS}"
else
echo "1..1" > "${TAP_RESULTS}"
echo "not ok 1 - found errors, run test manually" >> "${TAP_RESULTS}"
fi