diff options
Diffstat (limited to 'test/test_reopen_logs.rb')
-rw-r--r-- | test/test_reopen_logs.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test/test_reopen_logs.rb b/test/test_reopen_logs.rb index a5aeca7..b27e5be 100644 --- a/test/test_reopen_logs.rb +++ b/test/test_reopen_logs.rb @@ -45,10 +45,15 @@ class TestReopenLogs < Testcase Process.kill(:USR1, pid) Timeout.timeout(10) { sleep(0.01) until File.exist?(opath) } - res = http.request(Net::HTTP::Get.new("/bbb")) - assert_equal 200, res.code.to_i - assert_equal orig, res.body - Timeout.timeout(10) { Thread.pass until File.read(opath) =~ /bbb/ } + # we need to repeat the HTTP request since the worker_processes + # may not have switched to the new file, yet. + Timeout.timeout(10) do + begin + res = http.request(Net::HTTP::Get.new("/bbb")) + assert_equal 200, res.code.to_i + assert_equal orig, res.body + end until File.read(opath) =~ /bbb/ + end end rescue => e Yahns::Log.exception(Logger.new($stderr), "test", e) |