about summary refs log tree commit homepage
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-11-13 20:22:13 +0000
committerEric Wong <normalperson@yhbt.net>2012-11-13 20:22:13 +0000
commitf4af812a28b03508c96853739aea53f7a6714abf (patch)
treecbfe8ae9ae2a6c228f0176f93ff811030aade122 /test/test_helper.rb
parent4bd0dbdf2d27672dc941746e06b647ea26fe63ee (diff)
downloadunicorn-f4af812a28b03508c96853739aea53f7a6714abf.tar.gz
assert_nothing_raised ends up hiding errors and backtraces,
making things harder to debug.  Since Test::Unit already
fails on uncaught exceptions, there is no need to assert
on the lack of exceptions for a successful test run.

This is a followup to commit 5acf5522295c947d3118926d1a1077007f615de9
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb31
1 files changed, 14 insertions, 17 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 11dd5ee..cf98996 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -155,9 +155,8 @@ end
 
 def assert_shutdown(pid)
   wait_master_ready("test_stderr.#{pid}.log")
-  assert_nothing_raised { Process.kill(:QUIT, pid) }
-  status = nil
-  assert_nothing_raised { pid, status = Process.waitpid2(pid) }
+  Process.kill(:QUIT, pid)
+  pid, status = Process.waitpid2(pid)
   assert status.success?, "exited successfully"
 end
 
@@ -191,8 +190,8 @@ end
 def reexec_usr2_quit_test(pid, pid_file)
   assert File.exist?(pid_file), "pid file OK"
   assert ! File.exist?("#{pid_file}.oldbin"), "oldbin pid file"
-  assert_nothing_raised { Process.kill(:USR2, pid) }
-  assert_nothing_raised { retry_hit(["http://#{@addr}:#{@port}/"]) }
+  Process.kill(:USR2, pid)
+  retry_hit(["http://#{@addr}:#{@port}/"])
   wait_for_file("#{pid_file}.oldbin")
   wait_for_file(pid_file)
 
@@ -202,35 +201,33 @@ def reexec_usr2_quit_test(pid, pid_file)
   # kill old master process
   assert_not_equal pid, new_pid
   assert_equal pid, old_pid
-  assert_nothing_raised { Process.kill(:QUIT, old_pid) }
-  assert_nothing_raised { retry_hit(["http://#{@addr}:#{@port}/"]) }
+  Process.kill(:QUIT, old_pid)
+  retry_hit(["http://#{@addr}:#{@port}/"])
   wait_for_death(old_pid)
   assert_equal new_pid, File.read(pid_file).to_i
-  assert_nothing_raised { retry_hit(["http://#{@addr}:#{@port}/"]) }
-  assert_nothing_raised { Process.kill(:QUIT, new_pid) }
+  retry_hit(["http://#{@addr}:#{@port}/"])
+  Process.kill(:QUIT, new_pid)
 end
 
 def reexec_basic_test(pid, pid_file)
   results = retry_hit(["http://#{@addr}:#{@port}/"])
   assert_equal String, results[0].class
-  assert_nothing_raised { Process.kill(0, pid) }
+  Process.kill(0, pid)
   master_log = "#{@tmpdir}/test_stderr.#{pid}.log"
   wait_master_ready(master_log)
   File.truncate(master_log, 0)
   nr = 50
   kill_point = 2
-  assert_nothing_raised do
-    nr.times do |i|
-      hit(["http://#{@addr}:#{@port}/#{i}"])
-      i == kill_point and Process.kill(:HUP, pid)
-    end
+  nr.times do |i|
+    hit(["http://#{@addr}:#{@port}/#{i}"])
+    i == kill_point and Process.kill(:HUP, pid)
   end
   wait_master_ready(master_log)
   assert File.exist?(pid_file), "pid=#{pid_file} exists"
   new_pid = File.read(pid_file).to_i
   assert_not_equal pid, new_pid
-  assert_nothing_raised { Process.kill(0, new_pid) }
-  assert_nothing_raised { Process.kill(:QUIT, new_pid) }
+  Process.kill(0, new_pid)
+  Process.kill(:QUIT, new_pid)
 end
 
 def wait_for_file(path)