Commit 086d7b0e authored by Mikio Hara's avatar Mikio Hara Committed by Brad Fitzpatrick

net: deflake TestDialerDualStackFDLeak

Fixes #14717.
Updates #15157.

Change-Id: I7238b4fe39f3670c2dfe09b3a3df51a982f261ed
Reviewed-on: https://go-review.googlesource.com/23244
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 1f7a0d4b
...@@ -128,13 +128,16 @@ func TestDialerDualStackFDLeak(t *testing.T) { ...@@ -128,13 +128,16 @@ func TestDialerDualStackFDLeak(t *testing.T) {
t.Skipf("%s does not have full support of socktest", runtime.GOOS) t.Skipf("%s does not have full support of socktest", runtime.GOOS)
case "windows": case "windows":
t.Skipf("not implemented a way to cancel dial racers in TCP SYN-SENT state on %s", runtime.GOOS) t.Skipf("not implemented a way to cancel dial racers in TCP SYN-SENT state on %s", runtime.GOOS)
case "openbsd":
testenv.SkipFlaky(t, 15157)
} }
if !supportsIPv4 || !supportsIPv6 { if !supportsIPv4 || !supportsIPv6 {
t.Skip("both IPv4 and IPv6 are required") t.Skip("both IPv4 and IPv6 are required")
} }
closedPortDelay, expectClosedPortDelay := dialClosedPort()
if closedPortDelay > expectClosedPortDelay {
t.Errorf("got %v; want <= %v", closedPortDelay, expectClosedPortDelay)
}
before := sw.Sockets() before := sw.Sockets()
origTestHookLookupIP := testHookLookupIP origTestHookLookupIP := testHookLookupIP
defer func() { testHookLookupIP = origTestHookLookupIP }() defer func() { testHookLookupIP = origTestHookLookupIP }()
...@@ -163,7 +166,7 @@ func TestDialerDualStackFDLeak(t *testing.T) { ...@@ -163,7 +166,7 @@ func TestDialerDualStackFDLeak(t *testing.T) {
const N = 10 const N = 10
var wg sync.WaitGroup var wg sync.WaitGroup
wg.Add(N) wg.Add(N)
d := &Dialer{DualStack: true, Timeout: 100 * time.Millisecond} d := &Dialer{DualStack: true, Timeout: 100*time.Millisecond + closedPortDelay}
for i := 0; i < N; i++ { for i := 0; i < N; i++ {
go func() { go func() {
defer wg.Done() defer wg.Done()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment