Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 36 lines (26 sloc) 1.15 KB
# Test Hanuman Service locally or at a specified URL
# Sample usage:
# ./test
# ./test
function removeQuotes {
echo "$*"|sed -s "s/^\(\(\"\(.*\)\"\)\|\('\(.*\)'\)\)\$/\\3\\5/g"
if [ "$1" ]; then DOMAIN="$1"; fi
VER=$(curl -sSf --header "Content-Type:application" "$DOMAIN/")
echo "Should show Hanuman version: $VER"
echo -en "\nShould report return code 22 because of HTTP status 404: "
BAD=$(curl -sSf --header "Content-Type:application" "$DOMAIN/badURI/x/y/z/")
SID=$(curl -sSf --header "Content-Type:application" "$DOMAIN/newSimulation")
SIMULATION_ID=$(removeQuotes $SID)
echo -e "\nHanuman simulation ID is $SIMULATION_ID"
while true; do
MSG=$(curl -sSf --header "Content-Type:application" "$DOMAIN/status/$SIMULATION_ID")
echo -e "\n$(removeQuotes $MSG)"
sleep 3
if [ "$(echo "$MSG"|grep stopped)" ]; then exit; fi
# Causes
#MSG=$(curl -sSv --header "Content-Type:application" --data-urlencode "document=Of course you realize that this means war" "$DOMAIN/blah/$SIMULATION_ID")
#echo "$(removeQuotes $MSG)"