3 test -r random_blob || die
"random_blob required, run with 'make $0'"
5 t_plan
14 "ensure we're accounting worker_connections properly"
10 rainbows_setup
$model $nr
11 rainbows
-D sha1.ru
-c $unicorn_config
15 null_sha1
=da39a3ee5e6b4b0d3255bfef95601890afd80709
17 t_begin
"fire off concurrent processes" && {
19 req
='POST / HTTP/1.1\r\n'
20 req
="$req"'Host: example.com\r\n'
21 req
="$req"'Transfer-Encoding: chunked\r\n\r\n'
25 rtmpfiles
${i}_fifo
${i}_tmp
26 eval 'i_fifo=$'${i}_fifo
27 eval 'i_tmp=$'${i}_tmp
31 cat $i_fifo > $i_tmp &
32 # need a full HTTP request to get around
39 ) | socat
- TCP
:$listen > $i_fifo
45 t_begin
"check results" && {
48 eval 'i_tmp=$'${i}_tmp
51 test x
$null_sha1 = x$
(tail -1 $i_tmp)
55 t_begin
"repeat concurrent tests with faster clients" && {
58 eval 'i_tmp=$'${i}_tmp
60 curl
-sSf -T- </dev
/null http
://$listen/ > $i 2> $i_tmp &
65 t_begin
"check results" && {
68 eval 'i_tmp=$'${i}_tmp
71 test x
$null_sha1 = x$
(cat $i)
75 t_begin
"fire off truncated concurrent requests" && {
77 req
='POST / HTTP/1.1\r\n'
78 req
="$req"'Host: example.com\r\n'
79 req
="$req"'Transfer-Encoding: chunked\r\n'
84 eval 'i_tmp=$'${i}_tmp
88 # need a full HTTP request to get around
92 ) | socat
- TCP
:$listen > $i_tmp
98 t_begin
"check broken results" && {
101 eval 'i_tmp=$'${i}_tmp
103 test xok
= x$
(cat $i)
108 t_begin
"repeat concurrent tests with faster clients" && {
111 eval 'i_tmp=$'${i}_tmp
113 curl
-sSf -T- </dev
/null http
://$listen/ > $i 2> $i_tmp &
118 t_begin
"check results" && {
121 eval 'i_tmp=$'${i}_tmp
124 test x
$null_sha1 = x$
(cat $i)
128 t_begin
"fire off garbage" && {
131 rtmpfiles
${i}_fifo
${i}_tmp
132 eval 'i_fifo=$'${i}_fifo
133 eval 'i_tmp=$'${i}_tmp
137 cat $i_fifo > $i_tmp &
138 dd if=random_blob bs
=4096 count
=1
141 ) | socat
- TCP
:$listen > $i_fifo
147 t_begin
"check broken results" && {
150 eval 'i_tmp=$'${i}_tmp
152 test xok
= x$
(cat $i)
153 grep -F 'HTTP/1.1 400 Bad Request' $i_tmp
157 t_begin
"repeat concurrent tests with faster clients" && {
160 eval 'i_tmp=$'${i}_tmp
162 curl
-sSf -T- </dev
/null http
://$listen/ > $i 2> $i_tmp &
167 t_begin
"check results" && {
170 eval 'i_tmp=$'${i}_tmp
173 test x
$null_sha1 = x$
(cat $i)
177 t_begin
"teardown" && {