diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2019-09-29 09:10:35 +0000 |
---|---|---|
committer | Chris Akritidis <43294513+cakrit@users.noreply.github.com> | 2019-09-29 11:10:35 +0200 |
commit | 325857ef07822fa5e6a1330d96be55276d9e664a (patch) | |
tree | d9bcb3f8fa6f3ec61e911b901314df67a590988d /tests/alarm_repetition | |
parent | 7de804a4e1e0a34424bad7ecb6541cb71c0c7b2a (diff) |
Common pattern for web and alarms together with two bug fixes (#6783)
* script_pattern: Fix script and bring pattern
This commit fixes the error given by shellckeck on stress.sh and brings a pattern for the other scripts, no
less important its given the possibility to change the url from outside of the scripts
* script_pattern: shellcheke
Correct the request.sh after to change it to avoid warning errors from shellchecker
* script_pattern: Remove of garbage value
With this PR I am removing the garbage value of a script
* script_pattern: Restore color
These 3 scripts changed in this commit was not restoring the terminal color,
this commit fixes this
Diffstat (limited to 'tests/alarm_repetition')
-rw-r--r-- | tests/alarm_repetition/alarm.sh.in | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tests/alarm_repetition/alarm.sh.in b/tests/alarm_repetition/alarm.sh.in index 8555e0a3c0..09d6aaf463 100644 --- a/tests/alarm_repetition/alarm.sh.in +++ b/tests/alarm_repetition/alarm.sh.in @@ -7,7 +7,8 @@ HEALTHDIR="@configdir_POST@/health.d/" OUTDIR="workdir/" #url to do download -MURL="http://localhost:19999/api/v1/alarms?active" +QUERY="/api/v1/alarms?active" +MURL="http://localhost:19999$QUERY" #error messages RED='\033[0;31m' @@ -35,24 +36,26 @@ netdata_test_download() { grep "HTTP/1.1 200 OK" "$1" 2>/dev/null 1>/dev/null TEST="$?" if [ "$TEST" -ne "0" ]; then - echo -e "${RED} Error to get the alarms" - killall netdata + echo -e "${RED} Error to get the alarms. ${NOCOLOR}" + kill "$5" + rm "$HEALTHDIR/ram.conf" exit 1 fi COUNT=$(grep -w "\"last_repeat\":" "$2" | grep -c "$OPT" "\"0\"") if [ "$COUNT" -eq "0" ]; then - echo -e "${RED} Netdata gave an unexpected result when alarm repetition is $4" - killall netdata + echo -e "${RED} Netdata gave an unexpected result when alarm repetition is $4 ${NOCOLOR}" + killall "$5" + rm "$HEALTHDIR/ram.conf" exit 1 fi - echo -e "${GREEN} I got the expected result" + echo -e "${GREEN} I got the expected result ${NOCOLOR}" } get_the_logs() { curl -v -k --create-dirs -o "$OUTDIR/$1.out" "$MURL" 2> "$OUTDIR/$1.err" - netdata_test_download "$OUTDIR/$1.err" "$OUTDIR/$1.out" "$2" "$3" + netdata_test_download "$OUTDIR/$1.err" "$OUTDIR/$1.out" "$2" "$3" "$4" } process_data() { @@ -61,14 +64,14 @@ process_data() { NETDATAPID=$! echo -e "${NOCOLOR}Sleeping during $SEC seconds to create alarm entries" sleep $SEC - get_the_logs "$1" "$2" "$3" + get_the_logs "$1" "$2" "$3" "$NETDATAPID" kill $NETDATAPID } mkdir "$OUTDIR" CREATEDIR="$?" if [ "$CREATEDIR" -ne "0" ]; then - echo -e "${RED}Cannot create the output directory, it already exists. The test will overwrite previous results." + echo -e "${RED}Cannot create the output directory, it already exists. The test will overwrite previous results. ${NOCOLOR}" fi change_alarm_file "./0" "ram_without_repetition.conf" "$HEALTHDIR/ram.conf" @@ -81,6 +84,6 @@ cp -a netdata.conf_with_repetition netdata.conf process_data "ram_with" "I" "activated." rm netdata.conf -echo -e "${GREEN} all the tests were sucessful" +echo -e "${GREEN} all the tests were sucessful ${NOCOLOR}" rm "$HEALTHDIR/ram.conf" rm -rf $OUTDIR |