From 304dd1ea90c24e065fc60b19a23c81926bdc5fb3 Mon Sep 17 00:00:00 2001 From: evanweaver Date: Sat, 27 Oct 2007 00:58:48 +0000 Subject: let's say that a minor thread contention issue in the test suite is not a failure on jruby. on MRI i can determine the scheduling via sleep but jruby does what it wants. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@785 19e92222-5c0b-0410-8929-a290d50e31e9 --- test/test_ws.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_ws.rb b/test/test_ws.rb index 7aa6db5..24a807d 100644 --- a/test/test_ws.rb +++ b/test/test_ws.rb @@ -47,7 +47,7 @@ class WebServerTest < Test::Unit::TestCase end - def do_test(string, chunk, close_after=nil) + def do_test(string, chunk, close_after=nil, shutdown_delay=0) # Do not use instance variables here, because it needs to be thread safe socket = TCPSocket.new("127.0.0.1", 9998); request = StringIO.new(string) @@ -62,7 +62,9 @@ class WebServerTest < Test::Unit::TestCase sleep 1 end end + sleep(shutdown_delay) socket.write(" ") # Some platforms only raise the exception on attempted write + socket.flush end def test_trickle_attack @@ -85,7 +87,7 @@ class WebServerTest < Test::Unit::TestCase redirect_test_io do long = "GET /test HTTP/1.1\r\n" + ("X-Big: stuff\r\n" * 15000) + "\r\n" assert_raises Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED, Errno::EINVAL do - do_test(long, long.length/2) + do_test(long, long.length/2, 10) end end end -- cgit v1.2.3-24-ge0c7