3 test -r random_blob || die
"random_blob required, run with 'make $0'"
5 t_plan
13 "input trailer test $model"
7 t_begin
"setup and startup" && {
10 rainbows
-D content-md5.ru
-c $unicorn_config
14 t_begin
"staggered trailer upload" && {
15 zero_md5
="1B2M2Y8AsgTpgAmY7PhCfg=="
18 printf 'PUT /s HTTP/1.1\r\n'
19 printf 'Host: example.com\r\n'
20 printf 'Transfer-Encoding: chunked\r\n'
21 printf 'Trailer: Content-MD5\r\n\r\n'
22 printf '0\r\nContent-MD5: '
24 printf '%s\r\n\r\n' $zero_md5
27 ) | socat
- TCP
:$listen > $fifo
28 test xok
= x
"$(cat $ok)"
31 t_begin
"HTTP response is OK" && {
32 fgrep
'HTTP/1.1 200 OK' $tmp
35 t_begin
"upload small blob" && {
38 echo hello world | content-md5-put
41 ) | socat
- TCP
:$listen > $fifo
42 test xok
= x
"$(cat $ok)"
45 t_begin
"HTTP response is OK" && fgrep
'HTTP/1.1 200 OK' $tmp
46 t_begin
"no errors in stderr log" && check_stderr
48 t_begin
"big blob request" && {
51 content-md5-put
< random_blob
54 ) | socat
- TCP
:$listen > $fifo
55 test xok
= x
"$(cat $ok)"
58 t_begin
"HTTP response is OK" && fgrep
'HTTP/1.1 200 OK' $tmp
59 t_begin
"no errors in stderr log" && check_stderr
61 t_begin
"staggered blob upload" && {
65 dd bs
=164 count
=1 < random_blob
67 dd bs
=4545 count
=1 < random_blob
69 dd bs
=1234 count
=1 < random_blob
71 ) 2>/dev
/null | content-md5-put
72 test xsubok
= x
"$(cat $ok)"
75 ) | socat
- TCP
:$listen > $fifo
76 test xok
= x
"$(cat $ok)"
79 t_begin
"HTTP response is OK" && {
80 fgrep
'HTTP/1.1 200 OK' $tmp
83 t_begin
"no errors in stderr log" && check_stderr
85 t_begin
"kill server" && {