From f75d15547b497afa087849c7f8293a3a6eebb517 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Thu, 19 Dec 2019 16:22:37 +0100 Subject: [PATCH] TT#72700 add set_config.sh helper script Helps to execute manually the tests. So run_tests.sh can be called several times with -C options, skipping the config * wrap-and-sort -sat Change-Id: Id1426234a8fce3f0592016e2361d40ce256390af --- README | 11 ++++---- debian/control | 2 +- debian/kamailio-config-tests.install | 1 + set_config.sh | 42 ++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 7 deletions(-) create mode 100755 set_config.sh diff --git a/README b/README index 0e43b217..94618db5 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ Requiriments: ------------- - A working NGCP - sip-tester. sipp with ssl enabled ( needed for auth ). - We provide a version backported to wheezy + We provide a version backported See debian/control for the actual list of dependences @@ -51,14 +51,13 @@ Usage: #bash ./run_tests.sh [-p PROFILE ] [-K] [-c] [-r] -x scenarios_lnp #bash ./get_results.sh [-p PROFILE ] [-g] [-c] [-r] -x scenarios_lnp - If you want to run test manually just exec this onces: - #./bin/config_debug.pl on - #ngcpcfg apply 'cfgtest' + If you want to run test manually just exec this once: + #bash ./set_config.sh [-x GROUP] and run the check that you want: - #PERL5LIB="$$(pwd)/lib" ./bin/check.sh + #bash PERL5LIB="$(pwd)/lib" ./bin/check.sh this will run the test and the result taps or run all the tests as many times you want with: - #./bin/bench.sh $NUM + #bash ./bin/bench.sh $NUM If you want to test just a set of scenarios, set the SCENARIOS environment var. diff --git a/debian/control b/debian/control index e0d2fcfa..6a9df0bb 100644 --- a/debian/control +++ b/debian/control @@ -31,9 +31,9 @@ Depends: libyaml-libyaml-perl, ngcp-provisioning-tools, parallel, - python3:any, python3-pyinotify, python3-yaml, + python3:any, sip-tester (>= 1:3.3-1~), tcpdump, ${misc:Depends}, diff --git a/debian/kamailio-config-tests.install b/debian/kamailio-config-tests.install index ae344abe..558bf392 100644 --- a/debian/kamailio-config-tests.install +++ b/debian/kamailio-config-tests.install @@ -6,4 +6,5 @@ run_tests.sh /usr/share/kamailio-config-tests/ scenarios/ /usr/share/kamailio-config-tests/ scenarios_lnp /usr/share/kamailio-config-tests/ scenarios_pbx /usr/share/kamailio-config-tests/ +set_config.sh /usr/share/kamailio-config-tests/ sounds /usr/share/kamailio-config-tests/ diff --git a/set_config.sh b/set_config.sh new file mode 100755 index 00000000..9e9e3748 --- /dev/null +++ b/set_config.sh @@ -0,0 +1,42 @@ +#!/bin/bash +RUN_DIR="$(dirname "$0")" +export BASE_DIR=${BASE_DIR:-$RUN_DIR} +# Set up the environment, to use local perl modules +export PERL5LIB="${BASE_DIR}/lib" +BIN_DIR="${BASE_DIR}/bin" +GROUP="${GROUP:-scenarios}" +DOMAIN="spce.test" + +usage() { + echo "Usage: set_config.sh [-h] [-x GROUP]" + echo "Options:" + echo -e "\t-x set GROUP scenario. Default: scenarios" + echo -e "\t-h this help" + + echo "BASE_DIR:${BASE_DIR}" + echo "BIN_DIR:${BIN_DIR}" +} + +while getopts 'hx:' opt; do + case $opt in + h) usage; exit 0;; + x) GROUP=${OPTARG};; + *) echo "Unknown option ${opt}"; usage; exit 1;; + esac +done +shift $((OPTIND - 1)) + +error_flag=0 + +echo "$(date) - Removed apicert.pem" +rm -f "${BASE_DIR}/apicert.pem" +echo "$(date) - Setting config debug on" +"${BIN_DIR}/config_debug.pl" -g "${GROUP}" on ${DOMAIN} +if ! ngcpcfg apply "config debug on via kamailio-config-tests" ; then + echo "$(date) - ngcpcfg apply returned $?" + error_flag=4 +fi +echo "$(date) - Setting config debug on. Done[${error_flag}]" + +exit ${error_flag} +