1 nr_client
=${nr_client-4}
3 test -r random_blob || die
"random_blob required, run with 'make $0'"
5 t_plan
7 "concurrent rack.input hammer stress test"
7 t_begin
"setup and startup" && {
8 rtmpfiles curl_out curl_err
10 rainbows
-D sha1.ru
-c $unicorn_config
14 t_begin
"send $nr_client concurrent requests" && {
16 for i
in $
(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev
/null
)
19 curl
-sSf -T- http
://$listen/$i \
20 < random_blob
>> $curl_out 2>> $curl_err
24 t_info elapsed
=$
(( $
(date +%s
) - $start ))
27 t_begin
"kill server" && kill $rainbows_pid
29 t_begin
"got $nr_client responses" && {
30 test $nr_client -eq $
(wc -l < $curl_out)
33 t_begin
"all responses identical" && {
34 test 1 -eq $
(sort < $curl_out |
uniq |
wc -l)
37 t_begin
"sha1 matches on-disk sha1" && {
38 blob_sha1
=$
( expr "$(sha1sum < random_blob)" : '\([a-f0-9]\+\)')
39 t_info blob_sha1
=$blob_sha1
40 test x
"$blob_sha1" = x
"$(sort < $curl_out | uniq)"
43 t_begin
"no errors in stderr log" && check_stderr