twister

HTTP fault injector for testing
Log | Files | Refs | README | LICENSE

commit d395d9c42cd8e68c864016fa00ebafd3e5f50aee
parent 23e09bc8bf0a8a7b00703220b3fff4a0d084d4fe
Author: Marcello Stanisci <stanisci.m@gmail.com>
Date:   Mon,  3 Jun 2019 21:41:35 +0200

debug

Diffstat:
Msrc/test/test_twister.sh | 35++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/src/test/test_twister.sh b/src/test/test_twister.sh @@ -39,10 +39,14 @@ TWISTER_URL="http://[::1]:8888/" ./test_twister_webserver & web_server_pid=$! +echo Webserver launched. + # Launch the Twister. taler-twister-service -c ./test_twister.conf & twister_service_pid=$! +echo Twister launched. + # hack the response code. taler-twister -c ./test_twister.conf --responsecode 202 @@ -57,6 +61,9 @@ if ! test 202 = $status_code; then exit 1 fi + +echo -- "--responsecode 202 passed". + # malform response. taler-twister -c ./test_twister.conf --malform malformed_body=$(curl -s ${TWISTER_URL}) @@ -71,6 +78,7 @@ if test '{"hello":[{"this":"browser!"}],"when":"today"}' = \ exit 1 fi +echo -- "--malform passed". # flip string. taler-twister -c ./test_twister.conf -f "when" @@ -85,6 +93,8 @@ if test "$flip_field" = 'today'; then exit 1 fi +echo "field-flip passed". + # delete object. taler-twister -c ./test_twister.conf -d "hello.0" emptied_body=$(curl -s ${TWISTER_URL}) @@ -98,6 +108,8 @@ if ! test '{"hello":[],"when":"today"}' = "$emptied_body"; then exit 1 fi +echo "field-deletion passed". + # set boolean field taler-twister -c ./test_twister.conf \ -m "hello" \ @@ -113,6 +125,7 @@ if ! test \ exit 1 fi +echo "field-modification with boolean value passed". # set field taler-twister -c ./test_twister.conf \ @@ -129,6 +142,8 @@ if ! test \ exit 1 fi +echo "field-modification with string passed". + # check if cumulative mods work. taler-twister -c ./test_twister.conf \ -m "hello" -V "world" \ @@ -161,6 +176,7 @@ if ! test 200 = $status_code; then exit 1 fi +echo "cumulative mods passed". # Just upload a big blob; first with PUT then with POST. printf "{\"things\": \"%s\"}" \ @@ -175,6 +191,16 @@ status_code=$(curl \ -d@BIGBLOB.json \ -w "%{http_code}") +## check status code is okay. +if ! test 200 = $status_code; then + echo "PUTting big blob failed (status == ${status_code})." + kill $web_server_pid + kill $twister_service_pid + rm BIGBLOB.json + exit 1 +fi +echo "PUT big load passed". + status_code=$(curl \ -s "${TWISTER_URL}BIGPOST" \ -o /dev/null \ @@ -183,16 +209,19 @@ status_code=$(curl \ -d@BIGBLOB.json \ -w "%{http_code}") -rm BIGBLOB.json - ## check status code is okay. if ! test 200 = $status_code; then - echo "PUTting big blob failed (status == ${status_code})." + echo "POSTing big blob failed (status == ${status_code})." kill $web_server_pid kill $twister_service_pid + rm BIGBLOB.json exit 1 fi +echo "POST big load passed". + +rm BIGBLOB.json + # shutdown twister and webserver kill $web_server_pid kill $twister_service_pid