mirror of
https://github.com/golang/go
synced 2024-11-18 00:54:45 -07:00
net: fix TestDialTimeout on windows builder
I don't know what's out there, but something is answering to 127.0.71.111:80 on our builder, so use a different port. Also insert a check that the dial fails, which would have diagnosed this problem. Fixes #3016. R=golang-dev, mikioh.mikioh, r CC=golang-dev https://golang.org/cl/5754062
This commit is contained in:
parent
152a1aa610
commit
c804efb5de
@ -6,6 +6,7 @@ package net
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"testing"
|
||||
@ -44,13 +45,22 @@ func TestDialTimeout(t *testing.T) {
|
||||
errc <- err
|
||||
}()
|
||||
}
|
||||
case "darwin":
|
||||
case "darwin", "windows":
|
||||
// At least OS X 10.7 seems to accept any number of
|
||||
// connections, ignoring listen's backlog, so resort
|
||||
// to connecting to a hopefully-dead 127/8 address.
|
||||
// Same for windows.
|
||||
//
|
||||
// Use a bogus port (44444) instead of 80, because
|
||||
// on our 386 builder, this Dial succeeds, connecting
|
||||
// to an IIS web server somewhere. The data center
|
||||
// or VM or firewall must be stealing the TCP connection.
|
||||
go func() {
|
||||
_, err := DialTimeout("tcp", "127.0.71.111:80", 200*time.Millisecond)
|
||||
c, err := DialTimeout("tcp", "127.0.71.111:44444", 200*time.Millisecond)
|
||||
if err == nil {
|
||||
err = fmt.Errorf("unexpected: connected to %s!", c.RemoteAddr())
|
||||
c.Close()
|
||||
}
|
||||
errc <- err
|
||||
}()
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user