Permalink
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
#!/bin/bash/json
# Test Hanuman Service locally or at a specified URL
# Sample usage:
# ./test
# ./test http://hollow-winter-3011.herokuapp.com
function removeQuotes {
echo "$*"|sed -s "s/^\(\(\"\(.*\)\"\)\|\('\(.*\)'\)\)\$/\\3\\5/g"
}
DOMAIN=http://localhost:8585
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
done
# Causes https://github.com/jdegoes/blueeyes/issues/29
#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)"