Skip to content

Instantly share code, notes, and snippets.

@NSkelsey
Created July 5, 2017 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NSkelsey/4cb78d6e3c3cc322e44ff7f4229f7202 to your computer and use it in GitHub Desktop.
Save NSkelsey/4cb78d6e3c3cc322e44ff7f4229f7202 to your computer and use it in GitHub Desktop.
test_resp_time.sh
#!/bin/bash
set -x
set -e
TT=`tty`
BASE='http://localhost:8082'
printf 'Logging into service %s\n\n' $BASE
read session_id < <(curl -s -A 'test-script' \
-X POST -H 'Content-type: application/json' \
-d '{"password": "aDMIN-PASSWORD","username":"admin"}' \
$BASE/authentication | tee -p $TT | python -c 'import json, sys; print(json.loads(sys.stdin.read())["session_id"]);'
)
printf '\nAcquired session_id: %s\n' $session_id
printf '\nTesting response times\n\n'
curl -vvv -A 'test-script' \
-H "X-Session: $session_id" \
-w "|%{time_total}" \
-o /dev/null \
"$BASE/admin/users" &
curl -vvv -A 'test-script' \
-H "X-Session: $session_id" \
-w "|%{time_total}" \
-o /dev/null \
"$BASE/admin/receivers" &
curl -vvv -A 'test-script' \
-H "X-Session: $session_id" \
-o /dev/null \
-w "|%{time_total}" \
"$BASE/admin/fieldtemplate" &
curl -vvv -A 'test-script' \
-H "X-Session: $session_id" \
-o /dev/null \
-w "|%{time_total}" \
"$BASE/admin/node" &
curl -vvv -A 'test-script' \
-H "X-Session: $session_id" \
-w "|%{time_total}" \
-o /dev/null \
"$BASE/admin/notification" &
curl -vvv -A 'test-script' \
-H "X-Session: $session_id" \
-w "|%{time_total}" \
-o /dev/null \
"$BASE/admin/shorturls" &
curl -vvv -A 'test-script' \
-H "X-Session: $session_id" \
-w "|%{time_total}" \
-o /dev/null \
"$BASE/admin/anonmalies" &
curl -vvv -A 'test-script' \
-H "X-Session: $session_id" \
-o /dev/null \
-w "|%{time_total}" \
"$BASE/admin/overview/tips" &
curl -vvv -A 'test-script' \
-H "X-Session: $session_id" \
-o /dev/null \
-w "|%{time_total}" \
"$BASE/admin/overview/files"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment