Give time dependent tests more leeway

pull/115/head
Andy Wang 4 years ago
parent 13c1c3705b
commit 2682460d46

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

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

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

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

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

Loading…
Cancel
Save