mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Fix failures when all network interfaces are down
This commit is contained in:
parent
1fbccd02ee
commit
94e79e4c2d
2 changed files with 7 additions and 1 deletions
|
@ -19,6 +19,9 @@ describe :tcpsocket_new, shared: true do
|
|||
-> {
|
||||
TCPSocket.send(@method, "192.0.2.1", 80, connect_timeout: 0)
|
||||
}.should raise_error(Errno::ETIMEDOUT)
|
||||
rescue Errno::ENETUNREACH
|
||||
# In the case all network interfaces down.
|
||||
# raise_error cannot deal with multiple expected exceptions
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,6 +30,9 @@ describe :tcpsocket_new, shared: true do
|
|||
-> {
|
||||
TCPSocket.send(@method, "192.0.2.1", 80, connect_timeout: 0)
|
||||
}.should raise_error(IO::TimeoutError)
|
||||
rescue Errno::ENETUNREACH
|
||||
# In the case all network interfaces down.
|
||||
# raise_error cannot deal with multiple expected exceptions
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_connect_timeout
|
||||
assert_raise(IO::TimeoutError) do
|
||||
assert_raise(IO::TimeoutError, Errno::ENETUNREACH) do
|
||||
TCPSocket.new("192.0.2.1", 80, connect_timeout: 0)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue