Commit f072283b authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: add more debugging to TestServerAllowsBlockingRemoteAddr

It fails on Solaris often, but nowhere else.

Not sure why. Add some debugging.

Change-Id: I79fc710bd339ae972d624c73a46bd8d215729c10
Reviewed-on: https://go-review.googlesource.com/37659Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent a143f5d6
...@@ -953,17 +953,17 @@ func TestServerAllowsBlockingRemoteAddr(t *testing.T) { ...@@ -953,17 +953,17 @@ func TestServerAllowsBlockingRemoteAddr(t *testing.T) {
defer tr.CloseIdleConnections() defer tr.CloseIdleConnections()
c := &Client{Transport: tr, Timeout: time.Second} c := &Client{Transport: tr, Timeout: time.Second}
fetch := func(response chan string) { fetch := func(num int, response chan<- string) {
resp, err := c.Get(ts.URL) resp, err := c.Get(ts.URL)
if err != nil { if err != nil {
t.Error(err) t.Errorf("Request %d: %v", num, err)
response <- "" response <- ""
return return
} }
defer resp.Body.Close() defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
if err != nil { if err != nil {
t.Error(err) t.Errorf("Request %d: %v", num, err)
response <- "" response <- ""
return return
} }
...@@ -972,14 +972,14 @@ func TestServerAllowsBlockingRemoteAddr(t *testing.T) { ...@@ -972,14 +972,14 @@ func TestServerAllowsBlockingRemoteAddr(t *testing.T) {
// Start a request. The server will block on getting conn.RemoteAddr. // Start a request. The server will block on getting conn.RemoteAddr.
response1c := make(chan string, 1) response1c := make(chan string, 1)
go fetch(response1c) go fetch(1, response1c)
// Wait for the server to accept it; grab the connection. // Wait for the server to accept it; grab the connection.
conn1 := <-conns conn1 := <-conns
// Start another request and grab its connection // Start another request and grab its connection
response2c := make(chan string, 1) response2c := make(chan string, 1)
go fetch(response2c) go fetch(2, response2c)
var conn2 net.Conn var conn2 net.Conn
select { select {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment