summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLennart Weller <lhw@ring0.de>2016-05-25 10:36:24 +0000
committerLennart Weller <lhw@ring0.de>2016-05-25 10:36:24 +0000
commitb4f64f72a3e4bf590c60b0cbd6cd365aa1a58542 (patch)
treee6706c727a1fedb44da614453ad3e429a7403a9b /tests
parentImported Upstream version 1.1.0 (diff)
downloadnetdata-b4f64f72a3e4bf590c60b0cbd6cd365aa1a58542.tar.xz
netdata-b4f64f72a3e4bf590c60b0cbd6cd365aa1a58542.zip
Imported Upstream version 1.2.0upstream/1.2.0
Diffstat (limited to 'tests')
-rwxr-xr-xtests/stress.sh28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/stress.sh b/tests/stress.sh
index 572dc7d1..d09d6989 100755
--- a/tests/stress.sh
+++ b/tests/stress.sh
@@ -17,10 +17,10 @@ if [ "${#charts[@]}" -eq 0 ]
fi
update_every="$(curl "$host/netdata.conf" 2>/dev/null | grep "update every = " | head -n 1 | cut -d '=' -f 2)"
-[ $[ update_every + 1 - 1] -eq 0 ] && update_every=1
+[ $(( update_every + 1 - 1)) -eq 0 ] && update_every=1
entries="$(curl "$host/netdata.conf" 2>/dev/null | grep "history = " | head -n 1 | cut -d '=' -f 2)"
-[ $[ entries + 1 - 1] -eq 0 ] && entries=3600
+[ $(( entries + 1 - 1)) -eq 0 ] && entries=3600
# to compare equal things, set the entries to 3600 max
[ $entries -gt 3600 ] && entries=3600
@@ -35,8 +35,8 @@ formats=("jsonp" "json" "ssv" "csv" "datatable" "datasource" "tsv" "ssvcomma" "h
options="flip|jsonwrap"
now=$(date +%s)
-first=$[now - (entries * update_every)]
-duration=$[now - first]
+first=$((now - (entries * update_every)))
+duration=$((now - first))
file="$(mktemp /tmp/netdata-stress-XXXXXXXX)"
cleanup() {
@@ -50,22 +50,22 @@ do
echo "curl --compressed --keepalive-time 120 --header \"Connection: keep-alive\" \\" >$file
for x in {1..100}
do
- dt=$[RANDOM * duration / 32767]
- st=$[RANDOM * duration / 32767]
- et=$[ st + dt ]
- [ $et -gt $now ] && st=$[ now - dt ]
+ dt=$((RANDOM * duration / 32767))
+ st=$((RANDOM * duration / 32767))
+ et=$(( st + dt ))
+ [ $et -gt $now ] && st=$(( now - dt ))
- points=$[RANDOM * 2000 / 32767 + 2]
- st=$[first + st]
- et=$[first + et]
+ points=$((RANDOM * 2000 / 32767 + 2))
+ st=$((first + st))
+ et=$((first + et))
- mode=$[RANDOM * ${#modes[@]} / 32767]
+ mode=$((RANDOM * ${#modes[@]} / 32767))
mode="${modes[$mode]}"
- chart=$[RANDOM * ${#charts[@]} / 32767]
+ chart=$((RANDOM * ${#charts[@]} / 32767))
chart="${charts[$chart]}"
- format=$[RANDOM * ${#formats[@]} / 32767]
+ format=$((RANDOM * ${#formats[@]} / 32767))
format="${formats[$format]}"
echo "--url \"$host/api/v1/data?chart=$chart&mode=$mode&format=$format&options=$options&after=$st&before=$et&points=$points\" \\"