http2: fix nits in test

Change-Id: Ib988bde8f8ff5719fd24bf63bd5ece648602dbd8
Reviewed-on: https://go-review.googlesource.com/23460
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Mikio Hara
2016-05-26 10:07:17 +09:00
parent b3e9c8fbe0
commit dfd9ed699e
2 changed files with 11 additions and 11 deletions

View File

@@ -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)
})

View File

@@ -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()