Created
December 6, 2017 11:48
-
-
Save benfairless/ee0aa3b58180f0d16325be044a84675f to your computer and use it in GitHub Desktop.
Test Session IDs in JBoss EAP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
endpoint='127.0.0.1' | |
filename="/tmp/$(date +%Y-%m-%d-%H-%M-%S)" | |
cookiejar="${filename}_cookie.txt" | |
first="${filename}_first.txt" | |
second="${filename}_second.txt" | |
cmd="curl http://${endpoint}/balancer/ -c ${cookiejar} -b ${cookiejar}" | |
# Run curl twice, first to get sessionid and second to see if the sessionid results in the same response | |
$cmd -o $first 2>/dev/null | |
$cmd -o $second 2>/dev/null | |
# Compare the output of both runs | |
diff -q --label 'First run' $first --label 'Second run' $second >/dev/null 2>&1 | |
if [[ $? == '0' ]]; then | |
echo 'Session state is persisted. :)' | |
rm -f ${filename}* | |
exit 0 | |
else | |
echo 'Session state is not persisted. :(' | |
rm -f ${filename}* | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment