rev: AsyncResponse => DeferredResponse API cleanup
[rainbows.git] / t / lib-rack-input-hammer.sh
blobcb3f8c1f3f94eeb1c03149ff1eb764dea2bb1f29
1 nr_client=${nr_client-4}
2 . ./test-lib.sh
3 test -r random_blob || die "random_blob required, run with 'make $0'"
5 eval $(unused_listen)
6 rtmpfiles unicorn_config curl_out curl_err r_err r_out pid
8 cat > $unicorn_config <<EOF
9 listen "$listen"
10 pid "$pid"
11 stderr_path "$r_err"
12 stdout_path "$r_out"
13 Rainbows! do
14 use :$model
15 end
16 EOF
18 rainbows -D sha1.ru -c $unicorn_config
19 wait_for_pid $pid
21 start=$(date +%s)
22 for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
25 curl -sSf -T- http://$listen/$i \
26 < random_blob >> $curl_out 2>> $curl_err
27 ) &
28 done
29 wait
30 echo elapsed=$(( $(date +%s) - $start ))
32 kill $(cat $pid)
33 test $nr_client -eq $(wc -l < $curl_out)
34 test 1 -eq $(sort < $curl_out | uniq | wc -l)
35 blob_sha1=$( expr "$(sha1sum < random_blob)" : '\([a-f0-9]\+\)')
36 echo blob_sha1=$blob_sha1
37 test x"$blob_sha1" = x"$(sort < $curl_out | uniq)"
38 check_stderr