3 t_plan
9 "PrereadInput middleware tests"
5 t_begin
"setup and start" && {
6 random_blob_sha1
=$
(rsha1
< random_blob
)
8 unicorn
-D -c $unicorn_config preread_input.ru
12 t_begin
"single identity request" && {
13 curl
-sSf -T random_blob http
://$listen/ > $tmp
16 t_begin
"sha1 matches" && {
17 test x
"$(cat $tmp)" = x
"$random_blob_sha1"
20 t_begin
"single chunked request" && {
21 curl
-sSf -T- < random_blob http
://$listen/ > $tmp
24 t_begin
"sha1 matches" && {
25 test x
"$(cat $tmp)" = x
"$random_blob_sha1"
28 t_begin
"app only dispatched twice" && {
29 test 2 -eq "$(grep 'app dispatch:' < $r_err | count_lines )"
32 t_begin
"aborted chunked request" && {
34 curl
-sSf -T- < $fifo http
://$listen/ > $tmp &
40 t_begin
"app only dispatched twice" && {
41 test 2 -eq "$(grep 'app dispatch:' < $r_err | count_lines )"
44 t_begin
"killing succeeds" && {
45 kill -QUIT $unicorn_pid