support for Rack hijack in request and response
[unicorn.git] / t / t9000-preread-input.sh
blobb9da05e81e2731a4313f8444e5df891a41eeb140
1 #!/bin/sh
2 . ./test-lib.sh
3 t_plan 9 "PrereadInput middleware tests"
5 t_begin "setup and start" && {
6 random_blob_sha1=$(rsha1 < random_blob)
7 unicorn_setup
8 unicorn -D -c $unicorn_config preread_input.ru
9 unicorn_wait_start
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 | wc -l )"
32 t_begin "aborted chunked request" && {
33 rm -f $tmp
34 curl -sSf -T- < $fifo http://$listen/ > $tmp &
35 curl_pid=$!
36 kill -9 $curl_pid
37 wait
40 t_begin "app only dispatched twice" && {
41 test 2 -eq "$(grep 'app dispatch:' < $r_err | wc -l )"
44 t_begin "killing succeeds" && {
45 kill -QUIT $unicorn_pid
48 t_done