aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-09-30 17:41:14 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-09-30 19:03:04 +0900
commit94e79e4c2da8d69f45e67228a051bb1c09a367ec (patch)
treef42d486ff35e79c201f7d0dec4c372310a8e3dce /spec
parent1fbccd02eeb37cf3ecd408b0ec2a71bdf78aa00f (diff)
downloadruby-94e79e4c2da8d69f45e67228a051bb1c09a367ec.tar.gz
Fix failures when all network interfaces are down
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/library/socket/tcpsocket/shared/new.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/library/socket/tcpsocket/shared/new.rb b/spec/ruby/library/socket/tcpsocket/shared/new.rb
index d60260a01b..90f8d7e6a2 100644
--- a/spec/ruby/library/socket/tcpsocket/shared/new.rb
+++ b/spec/ruby/library/socket/tcpsocket/shared/new.rb
@@ -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