3 skip_models StreamResponseEpoll
4 test -r random_blob || die
"random_blob required, run with 'make $0'"
6 t_plan
10 "fast Kgio pipe response for $model"
8 t_begin
"setup and startup" && {
11 rainbows
-E none
-D kgio-pipe-response.ru
-c $unicorn_config
15 t_begin
"read random blob sha1" && {
16 random_blob_sha1
=$
(rsha1
< random_blob
)
17 three_sha1
=$
(cat random_blob random_blob random_blob | rsha1
)
20 t_begin
"single request matches" && {
21 sha1
=$
(curl
-sSfv 2> $err http
://$listen/ | rsha1
)
23 test x
"$sha1" = x
"$random_blob_sha1"
26 t_begin
"Content-Length header preserved in response" && {
27 grep "^< Content-Length:" $err
30 t_begin
"send three keep-alive requests" && {
31 sha1
=$
(curl
-vsSf 2> $err \
32 http
://$listen/ http
://$listen/ http
://$listen/ | rsha1
)
34 test x
"$sha1" = x
"$three_sha1"
37 t_begin
"ensure responses were all keep-alive" && {
38 test 3 -eq $
(grep '< Connection: keep-alive' < $err | count_lines
)
41 t_begin
"HTTP/1.0 test" && {
42 sha1
=$
(curl
-0 -v 2> $err -sSf http
://$listen/ | rsha1
)
43 test $sha1 = $random_blob_sha1
44 grep '< Connection: close' < $err
47 t_begin
"HTTP/0.9 test" && {
50 rsha1
< $fifo > $tmp &
53 ) | socat
- TCP
:$listen > $fifo
54 test $
(cat $tmp) = $random_blob_sha1
55 test xok
= x$
(cat $ok)
58 t_begin
"shutdown server" && {
59 kill -QUIT $rainbows_pid
62 t_begin
"check stderr" && check_stderr