From 1bfd30a1e3fa2c1d2729667ed698b7c604c2a1bd Mon Sep 17 00:00:00 2001 From: Misaki Shioi Date: Fri, 1 Dec 2023 09:31:33 +0900 Subject: [PATCH] Relax test conditions to velify Socket::ResolutionError#error_code The test for Socket::ResolutionError#error_code fails in the FreeBSD environment with this test condition. Because Socket::ResolutionError#error_code returns Socket::EAI_FAIL instead of Socket::EAI_FAMILY. https://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20231130T103002Z.fail.html.gz This PR avoids the test failure by relaxing the condition. Also changed the domain for testing to `example.com`. --- test/socket/test_socket.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index cdc9929bb6..6c3d6e198a 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -771,13 +771,10 @@ class TestSocket < Test::Unit::TestCase end def test_resolurion_error_error_code - # https://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20231130T103002Z.fail.html.gz - omit if /freebsd/ =~ RUBY_PLATFORM - begin - Socket.getaddrinfo("www.kame.net", 80, "AF_UNIX") + Socket.getaddrinfo("example.com", 80, "AF_UNIX") rescue => e - assert_equal(Socket::EAI_FAMILY, e.error_code) + assert_equal([Socket::EAI_FAMILY, Socket::EAI_FAIL].include?(e.error_code), true) end end