Fix failures when all network interfaces are down
This commit is contained in:
parent
1fbccd02ee
commit
94e79e4c2d
@ -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…
x
Reference in New Issue
Block a user