author | Mikio Hara
<mikioh.mikioh@gmail.com> 2016-05-26 01:07:17 UTC |
committer | Mikio Hara
<mikioh.mikioh@gmail.com> 2016-05-26 04:20:37 UTC |
parent | b3e9c8fbe09fe2b5b27bfb7320c1f77b640111be |
http2/server_test.go | +8 | -4 |
http2/transport_test.go | +3 | -7 |
diff --git a/http2/server_test.go b/http2/server_test.go index 540b0d9..61a7f9d 100644 --- a/http2/server_test.go +++ b/http2/server_test.go @@ -2879,8 +2879,12 @@ func (c *issue53Conn) Close() error { return nil } -func (c *issue53Conn) LocalAddr() net.Addr { return &net.TCPAddr{net.IP{127, 0, 0, 1}, 49706, ""} } -func (c *issue53Conn) RemoteAddr() net.Addr { return &net.TCPAddr{net.IP{127, 0, 0, 1}, 49706, ""} } +func (c *issue53Conn) LocalAddr() net.Addr { + return &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 49706} +} +func (c *issue53Conn) RemoteAddr() net.Addr { + return &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 49706} +} func (c *issue53Conn) SetDeadline(t time.Time) error { return nil } func (c *issue53Conn) SetReadDeadline(t time.Time) error { return nil } func (c *issue53Conn) SetWriteDeadline(t time.Time) error { return nil } @@ -3026,7 +3030,7 @@ func BenchmarkServer_GetRequest(b *testing.B) { st := newServerTester(b, func(w http.ResponseWriter, r *http.Request) { n, err := io.Copy(ioutil.Discard, r.Body) if err != nil || n > 0 { - b.Error("Read %d bytes, error %v; want 0 bytes.", n, err) + b.Errorf("Read %d bytes, error %v; want 0 bytes.", n, err) } io.WriteString(w, msg) }) @@ -3058,7 +3062,7 @@ func BenchmarkServer_PostRequest(b *testing.B) { st := newServerTester(b, func(w http.ResponseWriter, r *http.Request) { n, err := io.Copy(ioutil.Discard, r.Body) if err != nil || n > 0 { - b.Error("Read %d bytes, error %v; want 0 bytes.", n, err) + b.Errorf("Read %d bytes, error %v; want 0 bytes.", n, err) } io.WriteString(w, msg) }) diff --git a/http2/transport_test.go b/http2/transport_test.go index 62c7ab1..8f13ea4 100644 --- a/http2/transport_test.go +++ b/http2/transport_test.go @@ -13,7 +13,6 @@ import ( "fmt" "io" "io/ioutil" - "log" "math/rand" "net" "net/http" @@ -787,7 +786,6 @@ func testTransportReqBodyAfterResponse(t *testing.T, status int) { return fmt.Errorf("Unexpected client frame %v", f) } } - return nil } ct.run() } @@ -809,12 +807,12 @@ func TestTransportFullDuplex(t *testing.T) { pr, pw := io.Pipe() req, err := http.NewRequest("PUT", st.ts.URL, ioutil.NopCloser(pr)) if err != nil { - log.Fatal(err) + t.Fatal(err) } req.ContentLength = -1 res, err := c.Do(req) if err != nil { - log.Fatal(err) + t.Fatal(err) } defer res.Body.Close() if res.StatusCode != 200 { @@ -1578,7 +1576,6 @@ func testTransportResponseHeaderTimeout(t *testing.T, body bool) { } } } - return nil } ct.run() } @@ -1905,7 +1902,6 @@ func TestTransportReadHeadResponse(t *testing.T) { <-clientDone return nil } - return nil } ct.run() } @@ -1949,7 +1945,7 @@ func TestTransportHandlerBodyClose(t *testing.T) { n, err := io.Copy(ioutil.Discard, res.Body) res.Body.Close() if n != bodySize || err != nil { - t.Fatalf("req#d: Copy = %d, %v; want %d, nil", i, n, err, bodySize) + t.Fatalf("req#%d: Copy = %d, %v; want %d, nil", i, n, err, bodySize) } } tr.CloseIdleConnections()