mirror of https://github.com/golang/go.git
net: deflake TestPacketConn, increase timeout
Tests sometimes failed with:
ok mime/internal/quotedprintable 0.606s
ok mime/multipart 0.819s
--- FAIL: TestPacketConn (0.10s)
packetconn_test.go:96: PacketConn.ReadFrom failed: WSARecvFrom udp 127.0.0.1:64156: i/o timeout
FAIL
FAIL net 3.602s
ok net/http 4.618s
ok net/http/cgi 0.576s
Theory: 100 ms is too short. Small timer granularity on Wnidows, or an
allocation in the middle causing a GC sometimes?
In any case, increase it to 500 ms.
Change-Id: I48cc4d600eb168db9f85c0fd05335dd630254c3c
Reviewed-on: https://go-review.googlesource.com/4922
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
parent
cf14e0e333
commit
aedee30870
|
|
@ -74,9 +74,9 @@ func TestPacketConn(t *testing.T) {
|
|||
}
|
||||
defer closer(c1, netstr[0], tt.addr1, tt.addr2)
|
||||
c1.LocalAddr()
|
||||
c1.SetDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c1.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c1.SetWriteDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c1.SetDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
c1.SetReadDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
c1.SetWriteDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
|
||||
c2, err := ListenPacket(tt.net, tt.addr2)
|
||||
if err != nil {
|
||||
|
|
@ -84,14 +84,14 @@ func TestPacketConn(t *testing.T) {
|
|||
}
|
||||
defer closer(c2, netstr[0], tt.addr1, tt.addr2)
|
||||
c2.LocalAddr()
|
||||
c2.SetDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c2.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c2.SetWriteDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c2.SetDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
c2.SetReadDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
c2.SetWriteDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
rb2 := make([]byte, 128)
|
||||
|
||||
if _, err := c1.WriteTo(wb, c2.LocalAddr()); err != nil {
|
||||
t.Fatalf("PacketConn.WriteTo failed: %v", err)
|
||||
}
|
||||
rb2 := make([]byte, 128)
|
||||
if _, _, err := c2.ReadFrom(rb2); err != nil {
|
||||
t.Fatalf("PacketConn.ReadFrom failed: %v", err)
|
||||
}
|
||||
|
|
@ -130,9 +130,9 @@ func TestConnAndPacketConn(t *testing.T) {
|
|||
}
|
||||
defer closer(c1, netstr[0], tt.addr1, tt.addr2)
|
||||
c1.LocalAddr()
|
||||
c1.SetDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c1.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c1.SetWriteDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c1.SetDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
c1.SetReadDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
c1.SetWriteDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
|
||||
c2, err := Dial(tt.net, c1.LocalAddr().String())
|
||||
if err != nil {
|
||||
|
|
@ -141,9 +141,9 @@ func TestConnAndPacketConn(t *testing.T) {
|
|||
defer c2.Close()
|
||||
c2.LocalAddr()
|
||||
c2.RemoteAddr()
|
||||
c2.SetDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c2.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c2.SetWriteDeadline(time.Now().Add(100 * time.Millisecond))
|
||||
c2.SetDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
c2.SetReadDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
c2.SetWriteDeadline(time.Now().Add(500 * time.Millisecond))
|
||||
|
||||
if _, err := c2.Write(wb); err != nil {
|
||||
t.Fatalf("Conn.Write failed: %v", err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue