3 t_plan
18 "simple HTTP connection keepalive/pipelining tests for $model"
5 t_begin
"checking for config.ru for $model" && {
6 tbase
=simple-http_
$model.ru
10 t_begin
"setup and start" && {
13 echo "listen '$unix_socket'" >> $unicorn_config
14 rainbows
-D $tbase -c $unicorn_config
18 t_begin
"pid file exists" && {
22 t_begin
"single TCP request" && {
23 curl
-sSfv http
://$listen/
28 t_begin
"pipelining partial requests" && {
29 req
='GET / HTTP/1.1\r\nHost: example.com\r\n'
32 printf "$req"'\r\n'"$req"
34 printf 'Connection: close\r\n\r\n'
37 ) | socat
- UNIX
:$unix_socket > $fifo
41 t_begin
"two HTTP/1.1 responses" && {
42 test 2 -eq $
(grep '^HTTP/1.1' $tmp |
wc -l)
45 t_begin
"two HTTP/1.1 200 OK responses" && {
46 test 2 -eq $
(grep '^HTTP/1.1 200 OK' $tmp |
wc -l)
49 t_begin
'one "Connection: keep-alive" response' && {
50 test 1 -eq $
(grep '^Connection: keep-alive' $tmp |
wc -l)
53 t_begin
'one "Connection: close" response' && {
54 test 1 -eq $
(grep '^Connection: close' $tmp |
wc -l)
57 t_begin
'check subshell success' && {
58 test x
"$(cat $ok)" = xok
62 t_begin
"check stderr" && {
66 t_begin
"burst pipelining requests" && {
67 req
='GET / HTTP/1.1\r\nHost: example.com\r\n'
70 printf "$req"'\r\n'"$req"'Connection: close\r\n\r\n'
73 ) | socat
- UNIX
:$unix_socket > $fifo
79 t_begin
"two HTTP/1.1 responses" && {
80 test 2 -eq $
(grep '^HTTP/1.1' $tmp |
wc -l)
83 t_begin
"two HTTP/1.1 200 OK responses" && {
84 test 2 -eq $
(grep '^HTTP/1.1 200 OK' $tmp |
wc -l)
87 t_begin
'one "Connection: keep-alive" response' && {
88 test 1 -eq $
(grep '^Connection: keep-alive' $tmp |
wc -l)
91 t_begin
'one "Connection: close" response' && {
92 test 1 -eq $
(grep '^Connection: close' $tmp |
wc -l)
95 t_begin
'check subshell success' && {
96 test x
"$(cat $ok)" = xok
99 t_begin
"killing succeeds" && {