diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-11-08 01:57:14 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-11-08 02:49:14 -0800 |
commit | 8cd6f4d94503a568501b6e24bb785a8e002720c9 (patch) | |
tree | 82c6c2df9ec84038e55e08444a2b505f076ac031 /t/t0102-rack-input-short.sh | |
parent | b4f1271320d38e83141dbb38463c3a368661aef7 (diff) | |
download | rainbows-8cd6f4d94503a568501b6e24bb785a8e002720c9.tar.gz |
Explicitly requested short reads may cause too much data to be returned, which would be bad and potentially break the application. We need to ensure proper IO#readpartial-like semantics in both of these models.
Diffstat (limited to 't/t0102-rack-input-short.sh')
-rw-r--r-- | t/t0102-rack-input-short.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/t0102-rack-input-short.sh b/t/t0102-rack-input-short.sh new file mode 100644 index 0000000..97c079d --- /dev/null +++ b/t/t0102-rack-input-short.sh @@ -0,0 +1,32 @@ +#!/bin/sh +. ./test-lib.sh +test -r random_blob || die "random_blob required, run with 'make $0'" + +t_plan 4 "rack.input short read tests" + +t_begin "setup and startup" && { + rtmpfiles curl_out curl_err + rainbows_setup $model + rainbows -D sha1-random-size.ru -c $unicorn_config + blob_sha1=$(rsha1 random_blob) + t_info "blob_sha1=$blob_sha1" + rainbows_wait_start +} + +t_begin "regular request" && { + curl -sSf -T random_blob http://$listen/ > $curl_out 2> $curl_err + test x$blob_sha1 = x$(cat $curl_out) + test ! -s $curl_err +} + +t_begin "chunked request" && { + curl -sSf -T- < random_blob http://$listen/ > $curl_out 2> $curl_err + test x$blob_sha1 = x$(cat $curl_out) + test ! -s $curl_err +} + +t_begin "shutdown" && { + kill $rainbows_pid +} + +t_done |