use Timeout.timeout
* time: Object#timeout has been deprecated a long time ago, use Timeout.timeout. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
42f1ff1272
commit
beb1c085d5
@ -27,7 +27,7 @@ class DRbService
|
|||||||
@server || @@server
|
@server || @@server
|
||||||
end
|
end
|
||||||
def self.ext_service(name)
|
def self.ext_service(name)
|
||||||
timeout(100, RuntimeError) do
|
Timeout.timeout(100, RuntimeError) do
|
||||||
manager.service(name)
|
manager.service(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -53,7 +53,7 @@ class DRbEx
|
|||||||
end
|
end
|
||||||
|
|
||||||
def do_timeout(n)
|
def do_timeout(n)
|
||||||
timeout(0.1) do
|
Timeout.timeout(0.1) do
|
||||||
n.sleep(2)
|
n.sleep(2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -28,7 +28,7 @@ class TestIONonblock < Test::Unit::TestCase
|
|||||||
w.flush
|
w.flush
|
||||||
w << "a" * 4096
|
w << "a" * 4096
|
||||||
result = ""
|
result = ""
|
||||||
timeout(10) {
|
Timeout.timeout(10) {
|
||||||
t0 = Thread.new {
|
t0 = Thread.new {
|
||||||
Thread.pass
|
Thread.pass
|
||||||
w.close
|
w.close
|
||||||
|
@ -292,7 +292,7 @@ module Test
|
|||||||
return if @workers.empty?
|
return if @workers.empty?
|
||||||
@workers.reject! do |worker|
|
@workers.reject! do |worker|
|
||||||
begin
|
begin
|
||||||
timeout(1) do
|
Timeout.timeout(1) do
|
||||||
worker.quit
|
worker.quit
|
||||||
end
|
end
|
||||||
rescue Errno::EPIPE
|
rescue Errno::EPIPE
|
||||||
@ -303,7 +303,7 @@ module Test
|
|||||||
|
|
||||||
return if @workers.empty?
|
return if @workers.empty?
|
||||||
begin
|
begin
|
||||||
timeout(0.2 * @workers.size) do
|
Timeout.timeout(0.2 * @workers.size) do
|
||||||
Process.waitall
|
Process.waitall
|
||||||
end
|
end
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
|
@ -44,7 +44,7 @@ tddwpBAEDjcwMzA5NTYzMTU1MzAwpQMCARM=
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_session
|
def test_session
|
||||||
timeout(5) do
|
Timeout.timeout(5) do
|
||||||
start_server(OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ctx = OpenSSL::SSL::SSLContext.new("TLSv1")
|
ctx = OpenSSL::SSL::SSLContext.new("TLSv1")
|
||||||
@ -361,7 +361,7 @@ __EOS__
|
|||||||
ssl.connect
|
ssl.connect
|
||||||
last_client_session = ssl.session
|
last_client_session = ssl.session
|
||||||
ssl.close
|
ssl.close
|
||||||
timeout(5) do
|
Timeout.timeout(5) do
|
||||||
Thread.pass until called.key?(:new)
|
Thread.pass until called.key?(:new)
|
||||||
assert(called.delete(:new))
|
assert(called.delete(:new))
|
||||||
Thread.pass until called.key?(:remove)
|
Thread.pass until called.key?(:remove)
|
||||||
|
@ -53,7 +53,7 @@ class TestResolvDNS < Test::Unit::TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
server_thread = Thread.new {
|
server_thread = Thread.new {
|
||||||
msg, (_, client_port, _, client_address) = timeout(5) {u.recvfrom(4096)}
|
msg, (_, client_port, _, client_address) = Timeout.timeout(5) {u.recvfrom(4096)}
|
||||||
id, word2, qdcount, ancount, nscount, arcount = msg.unpack("nnnnnn")
|
id, word2, qdcount, ancount, nscount, arcount = msg.unpack("nnnnnn")
|
||||||
qr = (word2 & 0x8000) >> 15
|
qr = (word2 & 0x8000) >> 15
|
||||||
opcode = (word2 & 0x7800) >> 11
|
opcode = (word2 & 0x7800) >> 11
|
||||||
@ -160,7 +160,7 @@ class TestResolvDNS < Test::Unit::TestCase
|
|||||||
# A rase condition here.
|
# A rase condition here.
|
||||||
# Another program may use the port.
|
# Another program may use the port.
|
||||||
# But no way to prevent it.
|
# But no way to prevent it.
|
||||||
timeout(5) do
|
Timeout.timeout(5) do
|
||||||
Resolv::DNS.open(:nameserver_port => [[host, port]]) {|dns|
|
Resolv::DNS.open(:nameserver_port => [[host, port]]) {|dns|
|
||||||
assert_equal([], dns.getresources("test-no-server.example.org", Resolv::DNS::Resource::IN::A))
|
assert_equal([], dns.getresources("test-no-server.example.org", Resolv::DNS::Resource::IN::A))
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ EOT
|
|||||||
w.close
|
w.close
|
||||||
end,
|
end,
|
||||||
proc do |r|
|
proc do |r|
|
||||||
timeout(1) {
|
Timeout.timeout(1) {
|
||||||
assert_equal("before \xa2\xa2".encode("utf-8", "euc-jp"),
|
assert_equal("before \xa2\xa2".encode("utf-8", "euc-jp"),
|
||||||
r.gets(rs))
|
r.gets(rs))
|
||||||
}
|
}
|
||||||
|
@ -1591,7 +1591,7 @@ class TestProcess < Test::Unit::TestCase
|
|||||||
|
|
||||||
with_tmpchdir do
|
with_tmpchdir do
|
||||||
assert_nothing_raised('[ruby-dev:12261]') do
|
assert_nothing_raised('[ruby-dev:12261]') do
|
||||||
timeout(3) do
|
Timeout.timeout(3) do
|
||||||
pid = spawn('yes | ls')
|
pid = spawn('yes | ls')
|
||||||
Process.waitpid pid
|
Process.waitpid pid
|
||||||
end
|
end
|
||||||
|
@ -51,7 +51,7 @@ class TestReadPartial < Test::Unit::TestCase
|
|||||||
assert_equal('ab', r.readpartial(2))
|
assert_equal('ab', r.readpartial(2))
|
||||||
assert_equal('c', r.readpartial(2))
|
assert_equal('c', r.readpartial(2))
|
||||||
assert_raise(Timeout::Error) {
|
assert_raise(Timeout::Error) {
|
||||||
timeout(0.1) { r.readpartial(2) }
|
Timeout.timeout(0.1) { r.readpartial(2) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -65,7 +65,7 @@ class TestReadPartial < Test::Unit::TestCase
|
|||||||
assert_equal("f\n", r.readpartial(4096))
|
assert_equal("f\n", r.readpartial(4096))
|
||||||
assert_equal("ghi\n", r.readpartial(4096))
|
assert_equal("ghi\n", r.readpartial(4096))
|
||||||
assert_raise(Timeout::Error) {
|
assert_raise(Timeout::Error) {
|
||||||
timeout(0.1) { r.readpartial(2) }
|
Timeout.timeout(0.1) { r.readpartial(2) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -118,7 +118,7 @@ class TestGemRequestConnectionPool < Gem::TestCase
|
|||||||
pool.checkout
|
pool.checkout
|
||||||
|
|
||||||
t1 = Thread.new {
|
t1 = Thread.new {
|
||||||
timeout(1) do
|
Timeout.timeout(1) do
|
||||||
pool.checkout
|
pool.checkout
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class TestGemStreamUI < Gem::TestCase
|
|||||||
skip 'TTY detection broken on windows' if
|
skip 'TTY detection broken on windows' if
|
||||||
Gem.win_platform? unless RUBY_VERSION > '1.9.2'
|
Gem.win_platform? unless RUBY_VERSION > '1.9.2'
|
||||||
|
|
||||||
timeout(1) do
|
Timeout.timeout(1) do
|
||||||
expected_answer = "Arthur, King of the Britons"
|
expected_answer = "Arthur, King of the Britons"
|
||||||
@in.string = "#{expected_answer}\n"
|
@in.string = "#{expected_answer}\n"
|
||||||
actual_answer = @sui.ask("What is your name?")
|
actual_answer = @sui.ask("What is your name?")
|
||||||
@ -52,7 +52,7 @@ class TestGemStreamUI < Gem::TestCase
|
|||||||
|
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
timeout(0.1) do
|
Timeout.timeout(0.1) do
|
||||||
answer = @sui.ask("what is your favorite color?")
|
answer = @sui.ask("what is your favorite color?")
|
||||||
assert_equal nil, answer
|
assert_equal nil, answer
|
||||||
end
|
end
|
||||||
@ -62,7 +62,7 @@ class TestGemStreamUI < Gem::TestCase
|
|||||||
skip 'Always uses $stdin on windows' if
|
skip 'Always uses $stdin on windows' if
|
||||||
Gem.win_platform? unless RUBY_VERSION > '1.9.2'
|
Gem.win_platform? unless RUBY_VERSION > '1.9.2'
|
||||||
|
|
||||||
timeout(1) do
|
Timeout.timeout(1) do
|
||||||
expected_answer = "Arthur, King of the Britons"
|
expected_answer = "Arthur, King of the Britons"
|
||||||
@in.string = "#{expected_answer}\n"
|
@in.string = "#{expected_answer}\n"
|
||||||
actual_answer = @sui.ask_for_password("What is your name?")
|
actual_answer = @sui.ask_for_password("What is your name?")
|
||||||
@ -76,7 +76,7 @@ class TestGemStreamUI < Gem::TestCase
|
|||||||
|
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
timeout(0.1) do
|
Timeout.timeout(0.1) do
|
||||||
answer = @sui.ask_for_password("what is the airspeed velocity of an unladen swallow?")
|
answer = @sui.ask_for_password("what is the airspeed velocity of an unladen swallow?")
|
||||||
assert_equal nil, answer
|
assert_equal nil, answer
|
||||||
end
|
end
|
||||||
@ -88,7 +88,7 @@ class TestGemStreamUI < Gem::TestCase
|
|||||||
|
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
timeout(0.1) do
|
Timeout.timeout(0.1) do
|
||||||
answer = @sui.ask_yes_no("do coconuts migrate?", false)
|
answer = @sui.ask_yes_no("do coconuts migrate?", false)
|
||||||
assert_equal false, answer
|
assert_equal false, answer
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ class TestGemStreamUI < Gem::TestCase
|
|||||||
|
|
||||||
@in.tty = false
|
@in.tty = false
|
||||||
|
|
||||||
timeout(0.1) do
|
Timeout.timeout(0.1) do
|
||||||
assert_raises(Gem::OperationNotSupportedError) do
|
assert_raises(Gem::OperationNotSupportedError) do
|
||||||
@sui.ask_yes_no("do coconuts migrate?")
|
@sui.ask_yes_no("do coconuts migrate?")
|
||||||
end
|
end
|
||||||
|
@ -102,7 +102,7 @@ class TestSocketNonblock < Test::Unit::TestCase
|
|||||||
assert_raise(IO::WaitReadable) { u1.recvfrom_nonblock(100) }
|
assert_raise(IO::WaitReadable) { u1.recvfrom_nonblock(100) }
|
||||||
u2.send("", 0, u1.getsockname)
|
u2.send("", 0, u1.getsockname)
|
||||||
assert_nothing_raised("cygwin 1.5.19 has a problem to send an empty UDP packet. [ruby-dev:28915]") {
|
assert_nothing_raised("cygwin 1.5.19 has a problem to send an empty UDP packet. [ruby-dev:28915]") {
|
||||||
timeout(1) { IO.select [u1] }
|
Timeout.timeout(1) { IO.select [u1] }
|
||||||
}
|
}
|
||||||
mesg, inet_addr = u1.recvfrom_nonblock(100)
|
mesg, inet_addr = u1.recvfrom_nonblock(100)
|
||||||
assert_equal("", mesg)
|
assert_equal("", mesg)
|
||||||
@ -124,7 +124,7 @@ class TestSocketNonblock < Test::Unit::TestCase
|
|||||||
assert_raise(IO::WaitReadable) { u1.recv_nonblock(100) }
|
assert_raise(IO::WaitReadable) { u1.recv_nonblock(100) }
|
||||||
u2.send("", 0, u1.getsockname)
|
u2.send("", 0, u1.getsockname)
|
||||||
assert_nothing_raised("cygwin 1.5.19 has a problem to send an empty UDP packet. [ruby-dev:28915]") {
|
assert_nothing_raised("cygwin 1.5.19 has a problem to send an empty UDP packet. [ruby-dev:28915]") {
|
||||||
timeout(1) { IO.select [u1] }
|
Timeout.timeout(1) { IO.select [u1] }
|
||||||
}
|
}
|
||||||
mesg = u1.recv_nonblock(100)
|
mesg = u1.recv_nonblock(100)
|
||||||
assert_equal("", mesg)
|
assert_equal("", mesg)
|
||||||
|
@ -6,7 +6,7 @@ class TestTimeout < Test::Unit::TestCase
|
|||||||
def test_queue
|
def test_queue
|
||||||
q = Queue.new
|
q = Queue.new
|
||||||
assert_raise(Timeout::Error, "[ruby-dev:32935]") {
|
assert_raise(Timeout::Error, "[ruby-dev:32935]") {
|
||||||
timeout(0.01) { q.pop }
|
Timeout.timeout(0.01) { q.pop }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class TestTimeout < Test::Unit::TestCase
|
|||||||
bug8730 = '[Bug #8730]'
|
bug8730 = '[Bug #8730]'
|
||||||
e = nil
|
e = nil
|
||||||
assert_raise_with_message(Timeout::Error, /execution expired/, bug8730) do
|
assert_raise_with_message(Timeout::Error, /execution expired/, bug8730) do
|
||||||
timeout 0.01 do
|
Timeout.timeout 0.01 do
|
||||||
begin
|
begin
|
||||||
sleep 3
|
sleep 3
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
@ -42,7 +42,7 @@ class TestTimeout < Test::Unit::TestCase
|
|||||||
exc = Class.new(RuntimeError)
|
exc = Class.new(RuntimeError)
|
||||||
e = nil
|
e = nil
|
||||||
assert_nothing_raised(exc) do
|
assert_nothing_raised(exc) do
|
||||||
timeout 0.01, exc do
|
Timeout.timeout 0.01, exc do
|
||||||
begin
|
begin
|
||||||
sleep 3
|
sleep 3
|
||||||
rescue exc => e
|
rescue exc => e
|
||||||
@ -58,10 +58,10 @@ class TestTimeout < Test::Unit::TestCase
|
|||||||
def initialize(msg) super end
|
def initialize(msg) super end
|
||||||
end
|
end
|
||||||
assert_nothing_raised(ArgumentError, bug9354) do
|
assert_nothing_raised(ArgumentError, bug9354) do
|
||||||
assert_equal(:ok, timeout(100, err) {:ok})
|
assert_equal(:ok, Timeout.timeout(100, err) {:ok})
|
||||||
end
|
end
|
||||||
assert_raise_with_message(err, /execution expired/) do
|
assert_raise_with_message(err, /execution expired/) do
|
||||||
timeout 0.01, err do
|
Timeout.timeout 0.01, err do
|
||||||
sleep 3
|
sleep 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ module TestParallel
|
|||||||
@worker_in.puts "quit"
|
@worker_in.puts "quit"
|
||||||
rescue IOError, Errno::EPIPE
|
rescue IOError, Errno::EPIPE
|
||||||
end
|
end
|
||||||
timeout(2) do
|
Timeout.timeout(2) do
|
||||||
Process.waitpid(@worker_pid)
|
Process.waitpid(@worker_pid)
|
||||||
end
|
end
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
@ -38,7 +38,7 @@ module TestParallel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_run
|
def test_run
|
||||||
timeout(10) do
|
Timeout.timeout(10) do
|
||||||
assert_match(/^ready/,@worker_out.gets)
|
assert_match(/^ready/,@worker_out.gets)
|
||||||
@worker_in.puts "run #{TESTS}/ptest_first.rb test"
|
@worker_in.puts "run #{TESTS}/ptest_first.rb test"
|
||||||
assert_match(/^okay/,@worker_out.gets)
|
assert_match(/^okay/,@worker_out.gets)
|
||||||
@ -49,7 +49,7 @@ module TestParallel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_run_multiple_testcase_in_one_file
|
def test_run_multiple_testcase_in_one_file
|
||||||
timeout(10) do
|
Timeout.timeout(10) do
|
||||||
assert_match(/^ready/,@worker_out.gets)
|
assert_match(/^ready/,@worker_out.gets)
|
||||||
@worker_in.puts "run #{TESTS}/ptest_second.rb test"
|
@worker_in.puts "run #{TESTS}/ptest_second.rb test"
|
||||||
assert_match(/^okay/,@worker_out.gets)
|
assert_match(/^okay/,@worker_out.gets)
|
||||||
@ -62,7 +62,7 @@ module TestParallel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_accept_run_command_multiple_times
|
def test_accept_run_command_multiple_times
|
||||||
timeout(10) do
|
Timeout.timeout(10) do
|
||||||
assert_match(/^ready/,@worker_out.gets)
|
assert_match(/^ready/,@worker_out.gets)
|
||||||
@worker_in.puts "run #{TESTS}/ptest_first.rb test"
|
@worker_in.puts "run #{TESTS}/ptest_first.rb test"
|
||||||
assert_match(/^okay/,@worker_out.gets)
|
assert_match(/^okay/,@worker_out.gets)
|
||||||
@ -80,7 +80,7 @@ module TestParallel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_p
|
def test_p
|
||||||
timeout(10) do
|
Timeout.timeout(10) do
|
||||||
@worker_in.puts "run #{TESTS}/ptest_first.rb test"
|
@worker_in.puts "run #{TESTS}/ptest_first.rb test"
|
||||||
while buf = @worker_out.gets
|
while buf = @worker_out.gets
|
||||||
break if /^p (.+?)$/ =~ buf
|
break if /^p (.+?)$/ =~ buf
|
||||||
@ -90,7 +90,7 @@ module TestParallel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_done
|
def test_done
|
||||||
timeout(10) do
|
Timeout.timeout(10) do
|
||||||
@worker_in.puts "run #{TESTS}/ptest_forth.rb test"
|
@worker_in.puts "run #{TESTS}/ptest_forth.rb test"
|
||||||
7.times { @worker_out.gets }
|
7.times { @worker_out.gets }
|
||||||
buf = @worker_out.gets
|
buf = @worker_out.gets
|
||||||
@ -115,7 +115,7 @@ module TestParallel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_quit
|
def test_quit
|
||||||
timeout(10) do
|
Timeout.timeout(10) do
|
||||||
@worker_in.puts "quit"
|
@worker_in.puts "quit"
|
||||||
assert_match(/^bye$/m,@worker_out.read)
|
assert_match(/^bye$/m,@worker_out.read)
|
||||||
end
|
end
|
||||||
@ -134,7 +134,7 @@ module TestParallel
|
|||||||
def teardown
|
def teardown
|
||||||
begin
|
begin
|
||||||
if @test_pid
|
if @test_pid
|
||||||
timeout(2) do
|
Timeout.timeout(2) do
|
||||||
Process.waitpid(@test_pid)
|
Process.waitpid(@test_pid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -151,40 +151,40 @@ module TestParallel
|
|||||||
"--ruby", @options[:ruby].join(" "),
|
"--ruby", @options[:ruby].join(" "),
|
||||||
"-j","0", out: File::NULL, err: o)
|
"-j","0", out: File::NULL, err: o)
|
||||||
o.close
|
o.close
|
||||||
timeout(10) {
|
Timeout.timeout(10) {
|
||||||
assert_match(/Error: parameter of -j option should be greater than 0/,@test_out.read)
|
assert_match(/Error: parameter of -j option should be greater than 0/,@test_out.read)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_should_run_all_without_any_leaks
|
def test_should_run_all_without_any_leaks
|
||||||
spawn_runner
|
spawn_runner
|
||||||
buf = timeout(10){@test_out.read}
|
buf = Timeout.timeout(10) {@test_out.read}
|
||||||
assert_match(/^[SFE\.]{9}$/,buf)
|
assert_match(/^[SFE\.]{9}$/,buf)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_should_retry_failed_on_workers
|
def test_should_retry_failed_on_workers
|
||||||
spawn_runner
|
spawn_runner
|
||||||
buf = timeout(10){@test_out.read}
|
buf = Timeout.timeout(10) {@test_out.read}
|
||||||
assert_match(/^Retrying\.+$/,buf)
|
assert_match(/^Retrying\.+$/,buf)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_no_retry_option
|
def test_no_retry_option
|
||||||
spawn_runner "--no-retry"
|
spawn_runner "--no-retry"
|
||||||
buf = timeout(10){@test_out.read}
|
buf = Timeout.timeout(10) {@test_out.read}
|
||||||
refute_match(/^Retrying\.+$/,buf)
|
refute_match(/^Retrying\.+$/,buf)
|
||||||
assert_match(/^ +\d+\) Failure:\nTestD#test_fail_at_worker/,buf)
|
assert_match(/^ +\d+\) Failure:\nTestD#test_fail_at_worker/,buf)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_jobs_status
|
def test_jobs_status
|
||||||
spawn_runner "--jobs-status"
|
spawn_runner "--jobs-status"
|
||||||
buf = timeout(10){@test_out.read}
|
buf = Timeout.timeout(10) {@test_out.read}
|
||||||
assert_match(/\d+=ptest_(first|second|third|forth) */,buf)
|
assert_match(/\d+=ptest_(first|second|third|forth) */,buf)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_separate
|
def test_separate
|
||||||
# this test depends to --jobs-status
|
# this test depends to --jobs-status
|
||||||
spawn_runner "--jobs-status", "--separate"
|
spawn_runner "--jobs-status", "--separate"
|
||||||
buf = timeout(10){@test_out.read}
|
buf = Timeout.timeout(10) {@test_out.read}
|
||||||
assert(buf.scan(/(\d+?)[:=]/).flatten.uniq.size > 1)
|
assert(buf.scan(/(\d+?)[:=]/).flatten.uniq.size > 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -239,7 +239,7 @@ class TestQueue < Test::Unit::TestCase
|
|||||||
sleep 0.1
|
sleep 0.1
|
||||||
q << :s
|
q << :s
|
||||||
assert_nothing_raised(Timeout::Error) do
|
assert_nothing_raised(Timeout::Error) do
|
||||||
timeout(1) { th2.join }
|
Timeout.timeout(1) { th2.join }
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
[th1, th2].each do |th|
|
[th1, th2].each do |th|
|
||||||
|
@ -355,7 +355,7 @@ class TestWEBrickHTTPServer < Test::Unit::TestCase
|
|||||||
req = Net::HTTP::Get.new("/")
|
req = Net::HTTP::Get.new("/")
|
||||||
req['Connection'] = 'Keep-Alive'
|
req['Connection'] = 'Keep-Alive'
|
||||||
begin
|
begin
|
||||||
timeout(2) do
|
Timeout.timeout(2) do
|
||||||
http.request(req){|res| assert_equal("foo", res.body) }
|
http.request(req){|res| assert_equal("foo", res.body) }
|
||||||
end
|
end
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user