From 2682460d46d21c80b04a97241f4d69bae7d7083b Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Fri, 24 Apr 2020 01:19:30 +0100 Subject: [PATCH] Give time dependent tests more leeway --- internal/multiplex/bufferedPipe_test.go | 2 +- internal/multiplex/datagramBuffer_test.go | 2 +- internal/multiplex/streamBuffer_test.go | 4 ---- internal/multiplex/switchboard_test.go | 2 +- internal/test/integration_test.go | 4 ++-- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/internal/multiplex/bufferedPipe_test.go b/internal/multiplex/bufferedPipe_test.go index 80cf3a3..85b5f54 100644 --- a/internal/multiplex/bufferedPipe_test.go +++ b/internal/multiplex/bufferedPipe_test.go @@ -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)) diff --git a/internal/multiplex/datagramBuffer_test.go b/internal/multiplex/datagramBuffer_test.go index 91d8b33..cc39b56 100644 --- a/internal/multiplex/datagramBuffer_test.go +++ b/internal/multiplex/datagramBuffer_test.go @@ -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)) diff --git a/internal/multiplex/streamBuffer_test.go b/internal/multiplex/streamBuffer_test.go index 20ab571..67fb3a5 100644 --- a/internal/multiplex/streamBuffer_test.go +++ b/internal/multiplex/streamBuffer_test.go @@ -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) diff --git a/internal/multiplex/switchboard_test.go b/internal/multiplex/switchboard_test.go index 694c6b2..6d6e55f 100644 --- a/internal/multiplex/switchboard_test.go +++ b/internal/multiplex/switchboard_test.go @@ -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") } diff --git a/internal/test/integration_test.go b/internal/test/integration_test.go index 46ef977..b9c6cfc 100644 --- a/internal/test/integration_test.go +++ b/internal/test/integration_test.go @@ -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) }