mirror of
https://github.com/golang/go
synced 2024-11-05 18:36:08 +00:00
net: remove arbitrary deadlines in PacketConn tests
When TestPacketConn was added (in CL 6501057) it included arbitrary 100ms deadlines. Those deadlines were arbitrarily increased to 500ms in CL 4922. If the test is actually provoking a deadlock, allowing it to deadlock will give us a more useful goroutine dump. Otherwise, the deadlines don't seem all that useful — they appear to increase code coverage, but have no effect on the test in the typical case, and can only cause flakes on particularly-slow machines. For #43627 Change-Id: I83de5217c54c743b83adddf51d4f6f2bd5b91732 Reviewed-on: https://go-review.googlesource.com/c/go/+/368215 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
00dbcb33f8
commit
1b2930d70c
1 changed files with 0 additions and 13 deletions
|
@ -12,7 +12,6 @@ package net
|
|||
import (
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// The full stack test cases for IPConn have been moved to the
|
||||
|
@ -60,9 +59,6 @@ func TestPacketConn(t *testing.T) {
|
|||
}
|
||||
defer closer(c1, tt.net, tt.addr1, tt.addr2)
|
||||
c1.LocalAddr()
|
||||
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 {
|
||||
|
@ -70,9 +66,6 @@ func TestPacketConn(t *testing.T) {
|
|||
}
|
||||
defer closer(c2, tt.net, tt.addr1, tt.addr2)
|
||||
c2.LocalAddr()
|
||||
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 {
|
||||
|
@ -115,9 +108,6 @@ func TestConnAndPacketConn(t *testing.T) {
|
|||
}
|
||||
defer closer(c1, tt.net, tt.addr1, tt.addr2)
|
||||
c1.LocalAddr()
|
||||
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 {
|
||||
|
@ -126,9 +116,6 @@ func TestConnAndPacketConn(t *testing.T) {
|
|||
defer c2.Close()
|
||||
c2.LocalAddr()
|
||||
c2.RemoteAddr()
|
||||
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.Fatal(err)
|
||||
|
|
Loading…
Reference in a new issue