about summary refs log tree commit homepage
path: root/test/server_helper.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-10-18 17:41:47 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-18 17:42:37 +0000
commita3221be0cd53c4b5ca6546f1d06ab7ca94feff23 (patch)
treef94962d787b8a0cd02cb9da407a249fec93ef1ba /test/server_helper.rb
parentee6b1150abc9ee0c429ac88b839214e7933c4f92 (diff)
downloadyahns-a3221be0cd53c4b5ca6546f1d06ab7ca94feff23.tar.gz
This should help prevent us from running out of FDs prematurely
as our test suite becomes more multi-threaded.  We can also use
plain TCPSocket in tests where we inherit the file descriptor
from the parent (w/o accept).
Diffstat (limited to 'test/server_helper.rb')
-rw-r--r--test/server_helper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/server_helper.rb b/test/server_helper.rb
index 78d2f94..97a175a 100644
--- a/test/server_helper.rb
+++ b/test/server_helper.rb
@@ -11,7 +11,7 @@ module ServerHelper
     err.rewind
     lines = err.readlines.delete_if { |l| l =~ /INFO/ }
     assert lines.empty?, lines.join("\n")
-    err.close
+    err.close! if err == @err
   end
 
   def poke_until_dead(pid)
@@ -40,6 +40,7 @@ module ServerHelper
     raise
   end
 
+  # only use for newly bound sockets
   def get_tcp_client(host, port, tries = 500)
     begin
       c = TCPSocket.new(host, port)