aboutsummaryrefslogtreecommitdiff
path: root/src/net/dial_test.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2017-04-12 21:42:01 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2017-04-12 21:58:03 +0000
commit7faf30246a67746d0bbd0d762e5cd7309fadfc6f (patch)
treece187fab91e7b029281f551608781802df3b5a10 /src/net/dial_test.go
parentce3ee7cdae9059a2cfb1a801a34712f413afb211 (diff)
downloadgo-7faf30246a67746d0bbd0d762e5cd7309fadfc6f.tar.gz
go-7faf30246a67746d0bbd0d762e5cd7309fadfc6f.zip
net: delete TestDialTimeoutFDLeak
It's flaky and distracting. I'm not sure what it's testing, either. It hasn't saved us before. Somebody can resurrect it if they have time. Updates #15157 Change-Id: I27bbfe51e09b6259bba0f73d60d03a4d38711951 Reviewed-on: https://go-review.googlesource.com/40498 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/net/dial_test.go')
-rw-r--r--src/net/dial_test.go65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/net/dial_test.go b/src/net/dial_test.go
index e8547974b9..22140005eb 100644
--- a/src/net/dial_test.go
+++ b/src/net/dial_test.go
@@ -10,7 +10,6 @@ import (
"internal/poll"
"internal/testenv"
"io"
- "net/internal/socktest"
"runtime"
"sync"
"testing"
@@ -73,70 +72,6 @@ func TestDialLocal(t *testing.T) {
c.Close()
}
-func TestDialTimeoutFDLeak(t *testing.T) {
- switch runtime.GOOS {
- case "plan9":
- t.Skipf("%s does not have full support of socktest", runtime.GOOS)
- case "openbsd":
- testenv.SkipFlaky(t, 15157)
- }
-
- const T = 100 * time.Millisecond
-
- switch runtime.GOOS {
- case "plan9", "windows":
- origTestHookDialChannel := testHookDialChannel
- testHookDialChannel = func() { time.Sleep(2 * T) }
- defer func() { testHookDialChannel = origTestHookDialChannel }()
- if runtime.GOOS == "plan9" {
- break
- }
- fallthrough
- default:
- sw.Set(socktest.FilterConnect, func(so *socktest.Status) (socktest.AfterFilter, error) {
- time.Sleep(2 * T)
- return nil, poll.ErrTimeout
- })
- defer sw.Set(socktest.FilterConnect, nil)
- }
-
- // Avoid tracking open-close jitterbugs between netFD and
- // socket that leads to confusion of information inside
- // socktest.Switch.
- // It may happen when the Dial call bumps against TCP
- // simultaneous open. See selfConnect in tcpsock_posix.go.
- defer func() { sw.Set(socktest.FilterClose, nil) }()
- var mu sync.Mutex
- var attempts int
- sw.Set(socktest.FilterClose, func(so *socktest.Status) (socktest.AfterFilter, error) {
- mu.Lock()
- attempts++
- mu.Unlock()
- return nil, nil
- })
-
- const N = 100
- var wg sync.WaitGroup
- wg.Add(N)
- for i := 0; i < N; i++ {
- go func() {
- defer wg.Done()
- // This dial never starts to send any SYN
- // segment because of above socket filter and
- // test hook.
- c, err := DialTimeout("tcp", "127.0.0.1:0", T)
- if err == nil {
- t.Errorf("unexpectedly established: tcp:%s->%s", c.LocalAddr(), c.RemoteAddr())
- c.Close()
- }
- }()
- }
- wg.Wait()
- if attempts < N {
- t.Errorf("got %d; want >= %d", attempts, N)
- }
-}
-
func TestDialerDualStackFDLeak(t *testing.T) {
switch runtime.GOOS {
case "plan9":