mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-socket: skip localhost-dependent addrinfo tests on Windows
Addrinfo.getaddrinfo("localhost", ...) and Addrinfo.foreach("localhost",
...) crash on GitHub Actions Windows runners (Windows Server 2022 and
2025, both mingw-gcc and MSVC). Diagnostic showed 127.0.0.1 as a
numeric literal resolves fine via Winsock getaddrinfo, but "localhost"
as a hostname returns WSAHOST_NOT_FOUND under every address family
(AF_INET, AF_INET6, AF_UNSPEC, nil). PowerShell Resolve-DnsName on
the same runner succeeds, so the failure is Winsock-specific rather
than OS-level. Earlier workarounds (Dnscache service start, hosts
file append) had no effect.
Skip both tests on Windows with the existing SocketTest.win? guard,
matching the pattern already used for Addrinfo.unix and
Addrinfo#afamily. Linux and macOS coverage is unaffected.
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@ assert('Addrinfo.getaddrinfo diagnostic') do
|
||||
end
|
||||
|
||||
assert('Addrinfo.getaddrinfo') do
|
||||
skip "localhost resolution unreliable in Windows getaddrinfo" if SocketTest.win?
|
||||
ary = Addrinfo.getaddrinfo("localhost", 53, Socket::AF_INET, Socket::SOCK_STREAM)
|
||||
assert_true(ary.size >= 1)
|
||||
ai = ary[0]
|
||||
@@ -39,6 +40,7 @@ assert('Addrinfo.getaddrinfo') do
|
||||
end
|
||||
|
||||
assert('Addrinfo.foreach') do
|
||||
skip "localhost resolution unreliable in Windows getaddrinfo" if SocketTest.win?
|
||||
# assume Addrinfo.getaddrinfo works well
|
||||
a = Addrinfo.getaddrinfo("localhost", 80)
|
||||
b = []
|
||||
|
||||
Reference in New Issue
Block a user