Skip to content

Commit 0a0d57e

Browse files
authored
test_dns: Fix failure on Windows (#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: #50 follow-up: 6252914
1 parent 6252914 commit 0a0d57e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/resolv/test_dns.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def with_udp(host, port)
6767
def with_udp_and_tcp(host, port)
6868
if port == 0
6969
# Automatic port; we might need to retry until we find a port which is free on both UDP _and_ TCP.
70-
retries_remaining = 5
70+
retries_remaining = 10
7171
t = nil
7272
u = nil
7373
begin
@@ -709,7 +709,8 @@ def test_multiple_servers_with_timeout_and_truncated_tcp_fallback
709709
num_records = 50
710710

711711
with_udp_and_tcp('127.0.0.1', 0) do |u1, t1|
712-
with_tcp('0.0.0.0', 0) do |t2|
712+
with_udp_and_tcp('127.0.0.1', 0) do |u2,t2|
713+
u2.close # XXX: u2 UDP socket is not used, but using #with_udp_and_tcp to enable Windows EACCES workaround
713714
_, server1_port, _, server1_address = u1.addr
714715
_, server2_port, _, server2_address = t2.addr
715716

0 commit comments

Comments
 (0)