Sha256: ab0fa23e1b06cd182e747a3c24436b29e2f5d579c2454fcb51b8e9e963988f19

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

#!/bin/sh
. ./test-lib.sh

eval $(unused_listen)
rtmpfiles unicorn_config curl_out curl_err pid r_err r_out

nr_client=30
nr_thread=10

cat > $unicorn_config <<EOF
stderr_path "$r_err"
stdout_path "$r_out"
listen "$listen"
pid "$pid"
Rainbows! do
  use :ThreadPool
  worker_connections $nr_thread
end
EOF

rainbows -D t1000.ru -c $unicorn_config
wait_for_pid $pid

start=$(date +%s)
for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
do
	( curl -sSf http://$listen/$i >> $curl_out 2>> $curl_err ) &
done
wait
echo elapsed=$(( $(date +%s) - $start ))

kill $(cat $pid)

! test -s $curl_err
test x"$(wc -l < $curl_out)" = x$nr_client

nr=$(sort < $curl_out | uniq | wc -l)

test "$nr" -le $nr_thread
test "$nr" -gt 1

! grep Error $r_err

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rainbows-0.2.0 t/t1000-thread-pool-basic.sh