diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-10-11 20:54:05 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-10-11 20:54:05 -0700 |
commit | a267b68ad921d115615abfc15de25a947e86fe38 (patch) | |
tree | 54f2aeb3d958a85ff31c89f1a569e5e78f0dda6c /t | |
parent | 90a03ee550741465ea43fd70e087851e17246fb6 (diff) | |
download | rainbows-a267b68ad921d115615abfc15de25a947e86fe38.tar.gz |
They were completely broken in the refactoring :x
Diffstat (limited to 't')
-rwxr-xr-x | t/t1002-thread-pool-graceful.sh | 37 | ||||
-rwxr-xr-x | t/t2002-thread-spawn-graceful.sh | 37 |
2 files changed, 74 insertions, 0 deletions
diff --git a/t/t1002-thread-pool-graceful.sh b/t/t1002-thread-pool-graceful.sh new file mode 100755 index 0000000..48f9363 --- /dev/null +++ b/t/t1002-thread-pool-graceful.sh @@ -0,0 +1,37 @@ +#!/bin/sh +. ./test-lib.sh + +eval $(unused_listen) +rtmpfiles unicorn_config curl_out curl_err pid r_err r_out +nr_thread=10 +nr_client=10 +cat > $unicorn_config <<EOF +listen "$listen" +stderr_path "$r_err" +stdout_path "$r_out" +pid "$pid" +Rainbows! do + use :ThreadPool + worker_connections $nr_thread +end +EOF + +rainbows -D sleep.ru -c $unicorn_config +wait_for_pid $pid + +for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null) +do + curl -sSf http://$listen/5 >> $curl_out 2>> $curl_err & +done +sleep 2 +kill -QUIT $(cat $pid) +wait + +dbgcat r_err +! test -s $curl_err +test x"$(wc -l < $curl_out)" = x$nr_client +nr=$(sort < $curl_out | uniq | wc -l) + +test "$nr" -eq 1 +test x$(sort < $curl_out | uniq) = xHello +grep -v Error $r_err diff --git a/t/t2002-thread-spawn-graceful.sh b/t/t2002-thread-spawn-graceful.sh new file mode 100755 index 0000000..1eb1047 --- /dev/null +++ b/t/t2002-thread-spawn-graceful.sh @@ -0,0 +1,37 @@ +#!/bin/sh +. ./test-lib.sh + +eval $(unused_listen) +rtmpfiles unicorn_config curl_out curl_err pid r_err r_out +nr_thread=10 +nr_client=10 +cat > $unicorn_config <<EOF +listen "$listen" +stderr_path "$r_err" +stdout_path "$r_out" +pid "$pid" +Rainbows! do + use :ThreadSpawn + worker_connections $nr_thread +end +EOF + +rainbows -D sleep.ru -c $unicorn_config +wait_for_pid $pid + +for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null) +do + curl -sSf http://$listen/5 >> $curl_out 2>> $curl_err & +done +sleep 2 +kill -QUIT $(cat $pid) +wait + +dbgcat r_err +! test -s $curl_err +test x"$(wc -l < $curl_out)" = x$nr_client +nr=$(sort < $curl_out | uniq | wc -l) + +test "$nr" -eq 1 +test x$(sort < $curl_out | uniq) = xHello +grep -v Error $r_err |