Give time dependent tests more leeway

This commit is contained in:
Andy Wang 2020-04-24 01:19:30 +01:00
parent 13c1c3705b
commit 2682460d46
5 changed files with 5 additions and 9 deletions

View File

@ -60,7 +60,7 @@ func TestReadBlock(t *testing.T) {
pipe := NewBufferedPipe()
b := []byte{0x01, 0x02, 0x03}
go func() {
time.Sleep(10 * time.Millisecond)
time.Sleep(100 * time.Millisecond)
pipe.Write(b)
}()
b2 := make([]byte, len(b))

View File

@ -76,7 +76,7 @@ func TestDatagramBuffer_BlockingRead(t *testing.T) {
pipe := NewDatagramBuffer()
b := []byte{0x01, 0x02, 0x03}
go func() {
time.Sleep(10 * time.Millisecond)
time.Sleep(100 * time.Millisecond)
pipe.Write(Frame{Payload: b})
}()
b2 := make([]byte, len(b))

View File

@ -3,8 +3,6 @@ package multiplex
import (
"encoding/binary"
"io"
"time"
//"log"
"sort"
"testing"
@ -29,8 +27,6 @@ func TestRecvNewFrame(t *testing.T) {
sb.Write(frame)
}
time.Sleep(100 * time.Millisecond)
var sortedResult []uint64
for x := 0; x < len(set); x++ {
oct := make([]byte, 8)

View File

@ -178,7 +178,7 @@ func TestSwitchboard_ConnsCount(t *testing.T) {
sesh.sb.closeAll()
time.Sleep(100 * time.Millisecond)
time.Sleep(500 * time.Millisecond)
if sesh.sb.connsCount() != 0 {
t.Error("connsCount incorrect")
}

View File

@ -316,7 +316,7 @@ func TestClosingStreamsFromProxy(t *testing.T) {
serverConn, _ := pxyServerL.Accept()
serverConn.Close()
time.Sleep(300 * time.Millisecond)
time.Sleep(500 * time.Millisecond)
if _, err := clientConn.Read(make([]byte, 16)); err == nil {
t.Errorf("closing stream on server side is not reflected to the client: %v", err)
}
@ -329,7 +329,7 @@ func TestClosingStreamsFromProxy(t *testing.T) {
serverConn, _ := pxyServerL.Accept()
clientConn.Close()
time.Sleep(300 * time.Millisecond)
time.Sleep(500 * time.Millisecond)
if _, err := serverConn.Read(make([]byte, 16)); err == nil {
t.Errorf("closing stream on client side is not reflected to the server: %v", err)
}