summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSorah Fukumori <[email protected]>2024-08-14 08:13:06 +0900
committergit <[email protected]>2024-08-13 23:13:10 +0000
commitb20957bdfeaafcc6f842a3f427d1895b0325f62a (patch)
tree1ff3a8b6833c2041b4c65969e8038c0b7abf80f2
parent094e53360d3e2537339997606eaa45f37a375f18 (diff)
[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: https://github.com/ruby/resolv/commit/6252914e95dfdf8995d8074df6cafe6f0a76c1ca https://github.com/ruby/resolv/commit/0a0d57e369
-rw-r--r--test/resolv/test_dns.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb
index 9064e7a612..133dbab6cf 100644
--- a/test/resolv/test_dns.rb
+++ b/test/resolv/test_dns.rb
@@ -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