1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Join threads.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2014-05-31 14:05:54 +00:00
parent 6c6f9b19b4
commit f07096f7e1
2 changed files with 10 additions and 14 deletions

View file

@ -24,13 +24,11 @@ class TestOpenURI < Test::Unit::TestCase
:Port => 0})
_, port, _, host = srv.listeners[0].addr
begin
srv.start
th = srv.start
yield srv, dr, "http://#{host}:#{port}"
ensure
srv.shutdown
until srv.status == :Stop
sleep 0.1
end
th.join
end
}
end
@ -225,7 +223,7 @@ class TestOpenURI < Test::Unit::TestCase
_, proxy_port, _, proxy_host = proxy.listeners[0].addr
proxy_url = "http://#{proxy_host}:#{proxy_port}/"
begin
proxy.start
proxy_thread = proxy.start
srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } )
open("#{url}/proxy", :proxy=>proxy_url) {|f|
assert_equal("200", f.status[0])
@ -256,6 +254,7 @@ class TestOpenURI < Test::Unit::TestCase
assert_equal("", log); log.clear
ensure
proxy.shutdown
proxy_thread.join
end
}
end
@ -278,7 +277,7 @@ class TestOpenURI < Test::Unit::TestCase
_, proxy_port, _, proxy_host = proxy.listeners[0].addr
proxy_url = "http://#{proxy_host}:#{proxy_port}/"
begin
proxy.start
th = proxy.start
srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } )
exc = assert_raise(OpenURI::HTTPError) { open("#{url}/proxy", :proxy=>proxy_url) {} }
assert_equal("407", exc.io.status[0])
@ -296,6 +295,7 @@ class TestOpenURI < Test::Unit::TestCase
assert_equal("", log); log.clear
ensure
proxy.shutdown
th.join
end
}
end

View file

@ -31,13 +31,11 @@ class TestOpenURISSL
:Port => 0})
_, port, _, host = srv.listeners[0].addr
begin
srv.start
th = srv.start
yield srv, dr, "https://#{host}:#{port}"
ensure
srv.shutdown
until srv.status == :Stop
sleep 0.1
end
th.join
end
}
end
@ -85,7 +83,7 @@ class TestOpenURISSL
:Port => 0})
_, p_port, _, p_host = prxy.listeners[0].addr
begin
prxy.start
th = prxy.start
srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } )
open("#{url}/proxy", :proxy=>"http://#{p_host}:#{p_port}/", :ssl_ca_cert => cacert_filename) {|f|
assert_equal("200", f.status[0])
@ -101,9 +99,7 @@ class TestOpenURISSL
sio.truncate(0); sio.rewind
ensure
prxy.shutdown
until prxy.status == :Stop
sleep 0.1
end
th.join
end
}
end