Skip to content

Instantly share code, notes, and snippets.

@karmanov
Created August 20, 2018 13:36
Show Gist options
  • Save karmanov/6a41aa471ff9d424be97fd996fa0956d to your computer and use it in GitHub Desktop.
Save karmanov/6a41aa471ff9d424be97fd996fa0956d to your computer and use it in GitHub Desktop.
#!/bin/sh
COUNTER=0
while true
do
TIME=`gdate +%s.%N`
# if [ $((COUNTER%10)) -eq 0 ];
# then
# # every tenth invocation will be more than a minute old
# TIME=$((TIME - 61000))
# else
# if [ $((COUNTER%5)) -eq 0 ];
# then
# # every 5th invocation in between will be 15 seconds into the future
# TIME=$((TIME + 15000))
# fi
# fi
BODY="{\"amount\": $COUNTER, \"timestamp\": $TIME}"
STATUS=`curl -X POST --write-out %{http_code} -d "$BODY" -H 'content-type: application/json' 'http://localhost:8081/v2/transactions/' --silent`
echo "POST $STATUS - $BODY"
RESPONSE=`curl -G 'http://localhost:8081/v2/statistics' --silent`
echo "GET $RESPONSE"
COUNTER=$((COUNTER + 1))
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment