4 t_plan
15 "reopen rotated logs"
6 t_begin
"setup and startup" && {
7 rtmpfiles curl_out curl_err r_rot
9 unicorn
-D t0006.ru
-c $unicorn_config
13 t_begin
"ensure server is responsive" && {
14 test xtrue
= x$
(curl
-sSf http
://$listen/ 2> $curl_err)
17 t_begin
"ensure stderr log is clean" && check_stderr
19 t_begin
"external log rotation" && {
24 t_begin
"send reopen log signal (USR1)" && {
25 kill -USR1 $unicorn_pid
28 t_begin
"wait for rotated log to reappear" && {
30 while ! test -f $r_err && test $nr -ge 0
37 t_begin
"ensure server is still responsive" && {
38 test xtrue
= x$
(curl
-sSf http
://$listen/ 2> $curl_err)
41 t_begin
"wait for worker to reopen logs" && {
43 re
="worker=.* done reopening logs"
44 while ! grep "$re" < $r_err >/dev
/null
&& test $nr -ge 0
54 t_begin
"ensure no errors from curl" && {
58 t_begin
"current server stderr is clean" && check_stderr
60 t_begin
"rotated stderr is clean" && {
64 t_begin
"server is now writing logs to new stderr" && {
65 before_rot
=$
(wc -c < $r_rot)
66 before_err
=$
(wc -c < $r_err)
67 test xtrue
= x$
(curl
-sSf http
://$listen/ 2> $curl_err)
68 after_rot
=$
(wc -c < $r_rot)
69 after_err
=$
(wc -c < $r_err)
70 test $after_rot -eq $before_rot
71 test $after_err -gt $before_err
74 t_begin
"stop server" && {
80 t_begin
"current server stderr is clean" && check_stderr
81 t_begin
"rotated stderr is clean" && check_stderr
$r_rot