[ruby/resolv] test_dns: Fix failure on Windows
(https://github.com/ruby/resolv/pull/58)
test_dns: Fix failure on Windows
1. Switch to #with_udp_and_tcp helper method for EACCES retries on Windows;
the given UDP socket is unnecessary though.
2. Using 127.0.0.1 should be fine, as it must give different host:port pair.
3. On Windows, 5 retries of bind(2) appears still flaky, doubling it for sure.
follow-up: https://github.com/ruby/resolv/pull/50
follow-up: 6252914e95
https://github.com/ruby/resolv/commit/0a0d57e369
This commit is contained in:
parent
094e53360d
commit
b20957bdfe
@ -67,7 +67,7 @@ class TestResolvDNS < Test::Unit::TestCase
|
||||
def with_udp_and_tcp(host, port)
|
||||
if port == 0
|
||||
# Automatic port; we might need to retry until we find a port which is free on both UDP _and_ TCP.
|
||||
retries_remaining = 5
|
||||
retries_remaining = 10
|
||||
t = nil
|
||||
u = nil
|
||||
begin
|
||||
@ -709,7 +709,8 @@ class TestResolvDNS < Test::Unit::TestCase
|
||||
num_records = 50
|
||||
|
||||
with_udp_and_tcp('127.0.0.1', 0) do |u1, t1|
|
||||
with_tcp('0.0.0.0', 0) do |t2|
|
||||
with_udp_and_tcp('127.0.0.1', 0) do |u2,t2|
|
||||
u2.close # XXX: u2 UDP socket is not used, but using #with_udp_and_tcp to enable Windows EACCES workaround
|
||||
_, server1_port, _, server1_address = u1.addr
|
||||
_, server2_port, _, server2_address = t2.addr
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user