summaryrefslogtreecommitdiffhomepage
path: root/pkg/server/sockopt_linux_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/server/sockopt_linux_test.go')
-rw-r--r--pkg/server/sockopt_linux_test.go40
1 files changed, 0 insertions, 40 deletions
diff --git a/pkg/server/sockopt_linux_test.go b/pkg/server/sockopt_linux_test.go
index ca72a98f..d9ca3d5e 100644
--- a/pkg/server/sockopt_linux_test.go
+++ b/pkg/server/sockopt_linux_test.go
@@ -18,12 +18,8 @@ package server
import (
"bytes"
- "fmt"
- "net"
- "os"
"syscall"
"testing"
- "time"
"unsafe"
)
@@ -68,39 +64,3 @@ func Test_buildTcpMD5Sigv6(t *testing.T) {
t.Error("Something wrong v6")
}
}
-
-func Test_DialTCP_FDleak(t *testing.T) {
- openFds := func() int {
- pid := os.Getpid()
- f, err := os.OpenFile(fmt.Sprintf("/proc/%d/fdinfo", pid), os.O_RDONLY, 0)
- if err != nil {
- t.Fatal(err)
- }
- defer f.Close()
- names, err := f.Readdirnames(0)
- if err != nil {
- t.Fatal(err)
- }
- return len(names)
- }
-
- before := openFds()
-
- for i := 0; i < 10; i++ {
- laddr, _ := net.ResolveTCPAddr("tcp", net.JoinHostPort("127.0.0.1", "0"))
- d := tcpDialer{
- Dialer: net.Dialer{
- LocalAddr: laddr,
- Timeout: 1 * time.Second,
- },
- }
- if _, err := d.DialTCP("127.0.0.1", 1); err == nil {
- t.Fatalf("should not succeed")
- }
-
- }
-
- if after := openFds(); before != after {
- t.Fatalf("could be fd leak, %d %d", before, after)
- }
-}