stream_response_epoll: our most "special" concurrency option yet
[rainbows.git] / t / t0035-kgio-pipe-response.sh
blob552270feb3845c484571020ea3b49ce0aaef04ba
1 #!/bin/sh
2 . ./test-lib.sh
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" && {
9 rtmpfiles err out
10 rainbows_setup $model
11 rainbows -E none -D kgio-pipe-response.ru -c $unicorn_config
12 rainbows_wait_start
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)
22 test -n "$sha1"
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)
33 test -n "$sha1"
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 | wc -l)
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" && {
49 printf 'GET /\r\n'
50 rsha1 < $fifo > $tmp &
51 wait
52 echo ok > $ok
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
64 t_done