mirror of
https://github.com/golang/go.git
synced 2025-05-30 11:51:34 +00: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 (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
@ -44,13 +45,22 @@ func TestDialTimeout(t *testing.T) {
|
|||||||
errc <- err
|
errc <- err
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
case "darwin":
|
case "darwin", "windows":
|
||||||
// At least OS X 10.7 seems to accept any number of
|
// At least OS X 10.7 seems to accept any number of
|
||||||
// connections, ignoring listen's backlog, so resort
|
// connections, ignoring listen's backlog, so resort
|
||||||
// to connecting to a hopefully-dead 127/8 address.
|
// to connecting to a hopefully-dead 127/8 address.
|
||||||
// Same for windows.
|
// 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() {
|
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
|
errc <- err
|
||||||
}()
|
}()
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user