mirror of
https://github.com/wled/WLED.git
synced 2025-07-20 09:16:31 +00:00
tools/stress_test: Allow command line target spec
This commit is contained in:
parent
91efcb910b
commit
abcd2a2d01
@ -4,14 +4,16 @@
|
|||||||
# Perform a large number of parallel requests, stress testing the web server
|
# Perform a large number of parallel requests, stress testing the web server
|
||||||
# TODO: some kind of performance metrics
|
# TODO: some kind of performance metrics
|
||||||
|
|
||||||
|
# Accepts two command line arguments:
|
||||||
TARGET=$1
|
# - first argument - mandatory - IP or hostname of target server
|
||||||
|
# - second argument - targert type
|
||||||
|
HOST=$1
|
||||||
|
declare -n TARGET_STR="${2:-JSON_LARGER}_TARGETS"
|
||||||
|
|
||||||
CURL_ARGS="--compressed --parallel --parallel-immediate --parallel-max 50"
|
CURL_ARGS="--compressed --parallel --parallel-immediate --parallel-max 50"
|
||||||
|
|
||||||
JSON_TARGETS=('json/state' 'json/info' 'json/si', 'json/palettes' 'json/fxdata' 'settings/s.js?p=2')
|
JSON_TARGETS=('json/state' 'json/info' 'json/si', 'json/palettes' 'json/fxdata' 'settings/s.js?p=2')
|
||||||
FILE_TARGETS=('' 'iro.js' 'rangetouch.js' 'settings' 'settings/wifi')
|
FILE_TARGETS=('' 'iro.js' 'rangetouch.js' 'settings' 'settings/wifi')
|
||||||
|
|
||||||
# Replicate one target many times
|
# Replicate one target many times
|
||||||
function replicate() {
|
function replicate() {
|
||||||
printf "${1}?%d " {1..8}
|
printf "${1}?%d " {1..8}
|
||||||
@ -19,15 +21,10 @@ function replicate() {
|
|||||||
read -a JSON_LARGE_TARGETS <<< $(replicate "json/si")
|
read -a JSON_LARGE_TARGETS <<< $(replicate "json/si")
|
||||||
read -a JSON_LARGER_TARGETS <<< $(replicate "json/fxdata")
|
read -a JSON_LARGER_TARGETS <<< $(replicate "json/fxdata")
|
||||||
|
|
||||||
# TODO: argument parsing
|
|
||||||
|
|
||||||
# Test static file targets
|
|
||||||
#TARGETS=(${JSON_TARGETS[@]})
|
|
||||||
#TARGETS=(${FILE_TARGETS[@]})
|
|
||||||
TARGETS=(${JSON_LARGER_TARGETS[@]})
|
|
||||||
|
|
||||||
# Expand target URLS to full arguments for curl
|
# Expand target URLS to full arguments for curl
|
||||||
FULL_OPTIONS=$(printf "http://${TARGET}/%s -o /dev/null " "${TARGETS[@]}")
|
TARGETS=(${TARGET_STR[@]})
|
||||||
|
#echo "${TARGETS[@]}"
|
||||||
|
FULL_TGT_OPTIONS=$(printf "http://${HOST}/%s -o /dev/null " "${TARGETS[@]}")
|
||||||
|
#echo ${FULL_TGT_OPTIONS}
|
||||||
|
|
||||||
#echo ${FULL_OPTIONS}
|
time curl ${CURL_ARGS} ${FULL_TGT_OPTIONS}
|
||||||
time curl ${CURL_ARGS} ${FULL_OPTIONS}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user