]> Cypherpunks repositories - gostls13.git/commitdiff
net: delete TestDialTimeoutFDLeak
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 12 Apr 2017 21:42:01 +0000 (21:42 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 12 Apr 2017 21:58:03 +0000 (21:58 +0000)
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>
src/net/dial_test.go

index e8547974b95b88429f1b685523c42035dd6d2819..22140005eb3f1d44173b67a5564a03366555a375 100644 (file)
@@ -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":