diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /tests/stress.sh | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-a64a253794ac64cb40befee54db53bde17dd0d49.tar.xz netdata-a64a253794ac64cb40befee54db53bde17dd0d49.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | tests/stress.sh | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/stress.sh b/tests/stress.sh index d09d69895..9c9393d3b 100755 --- a/tests/stress.sh +++ b/tests/stress.sh @@ -1,17 +1,19 @@ #!/bin/bash +# SPDX-License-Identifier: GPL-3.0-or-later # set the host to connect to if [ ! -z "$1" ] - then +then host="$1" else host="http://127.0.0.1:19999" fi echo "using netdata server at: $host" +# shellcheck disable=SC2207 disable=SC1117 charts=($(curl "$host/netdata.conf" 2>/dev/null | grep "^\[" | cut -d '[' -f 2 | cut -d ']' -f 1 | grep -v ^global$ | grep -v "^plugin" | sort -u)) if [ "${#charts[@]}" -eq 0 ] - then +then echo "Cannot download charts from server: $host" exit 1 fi @@ -26,7 +28,7 @@ entries="$(curl "$host/netdata.conf" 2>/dev/null | grep "history = " | head -n 1 [ $entries -gt 3600 ] && entries=3600 if [ $entries -ne 3600 ] - then +then echo >&2 "You are running a test for a history of $entries entries." fi @@ -41,19 +43,20 @@ duration=$((now - first)) file="$(mktemp /tmp/netdata-stress-XXXXXXXX)" cleanup() { echo "cleanup" - [ -f $file ] && rm $file + [ -f "$file" ] && rm "$file" } trap cleanup EXIT -while [ 1 = 1 ] +while true do - echo "curl --compressed --keepalive-time 120 --header \"Connection: keep-alive\" \\" >$file + echo "curl --compressed --keepalive-time 120 --header \"Connection: keep-alive\" \\" >"$file" + # shellcheck disable=SC2034 for x in {1..100} do dt=$((RANDOM * duration / 32767)) st=$((RANDOM * duration / 32767)) et=$(( st + dt )) - [ $et -gt $now ] && st=$(( now - dt )) + [ $et -gt "$now" ] && st=$(( now - dt )) points=$((RANDOM * 2000 / 32767 + 2)) st=$((first + st)) @@ -69,6 +72,6 @@ do format="${formats[$format]}" echo "--url \"$host/api/v1/data?chart=$chart&mode=$mode&format=$format&options=$options&after=$st&before=$et&points=$points\" \\" - done >>$file - bash $file >/dev/null + done >>"$file" + bash "$file" >/dev/null done |