commit cecc7bb3c76c909988e098dde86b822112196b21 parent f2f71e19a9b45b0d32d9233110b6b0d00a1cfb7a Author: Marcello Stanisci <stanisci.m@gmail.com> Date: Mon, 3 Jun 2019 20:01:37 +0200 Tests for 5724. Adding a PUT and POST test case with a fair big JSON. Diffstat:
| M | src/test/test_twister.sh | | | 34 | +++++++++++++++++++++++++++++++++- |
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/test/test_twister.sh b/src/test/test_twister.sh @@ -144,7 +144,7 @@ if ! test '{"hello":"world"}' = $cum_mods; then exit 1 fi -# check if Twister does compression. +# check if Twister decompresses. status_code=$(curl \ -s "${TWISTER_URL}deflate-test" \ -o /dev/null \ @@ -161,6 +161,38 @@ if ! test 200 = $status_code; then exit 1 fi + +# Just upload a big blob; first with PUT then with POST. +printf "{\"things\": \"%s\"}" \ + $(for i in $(seq 1 100000); do + echo -n z; done) > BIGBLOB.json + +status_code=$(curl \ + -s "${TWISTER_URL}BIGPUT" \ + -o /dev/null \ + -X PUT \ + -H "Content-Type: application/json" \ + -d@BIGBLOB.json \ + -w "%{http_code}") + +status_code=$(curl \ + -s "${TWISTER_URL}BIGPOST" \ + -o /dev/null \ + -X POST \ + -H "Content-Type: application/json" \ + -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})." + kill $web_server_pid + kill $twister_service_pid + exit 1 +fi + # shutdown twister and webserver kill $web_server_pid kill $twister_service_pid