From 144d5924232fddc9b7bfaa0e3aa1e4647da7190b Mon Sep 17 00:00:00 2001 From: Hannah Kim Date: Thu, 19 Dec 2024 11:11:16 -0500 Subject: [PATCH] contrib/miekg/dns: resolve flaky test in TestExchange* (#3045) --- contrib/miekg/dns/dns_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/miekg/dns/dns_test.go b/contrib/miekg/dns/dns_test.go index c1efa2a799..6e38fbaca5 100644 --- a/contrib/miekg/dns/dns_test.go +++ b/contrib/miekg/dns/dns_test.go @@ -33,7 +33,7 @@ func startServer(t *testing.T, traced bool) (*dns.Server, func()) { if traced { h = dnstrace.WrapHandler(h) } - addr := getFreeAddr(t).String() + addr := getAddr(t).String() server := &dns.Server{ Addr: addr, Net: "udp", @@ -190,8 +190,8 @@ func assertClientSpan(t *testing.T, s mocktracer.Span) { assert.Equal(t, ext.SpanKindClient, s.Tag(ext.SpanKind)) } -func getFreeAddr(t *testing.T) net.Addr { - li, err := net.Listen("tcp", "127.0.0.1:0") +func getAddr(t *testing.T) net.Addr { + li, err := net.Listen("tcp4", "127.0.0.1:2020") if err != nil { t.Fatal(err) }