зеркало из https://github.com/github/ruby.git
Fix failures when all network interfaces are down
This commit is contained in:
Родитель
1fbccd02ee
Коммит
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче