diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6fbe39a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: go - -go: - - "1.15" - -script: - - go test -race -coverprofile=coverage.txt -coverpkg=./... -covermode=atomic ./... - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/internal/multiplex/datagramBufferedPipe_test.go b/internal/multiplex/datagramBufferedPipe_test.go index f03cff0..4a5d4e2 100644 --- a/internal/multiplex/datagramBufferedPipe_test.go +++ b/internal/multiplex/datagramBufferedPipe_test.go @@ -76,7 +76,7 @@ func TestDatagramBuffer_BlockingRead(t *testing.T) { pipe := NewDatagramBufferedPipe() b := []byte{0x01, 0x02, 0x03} go func() { - time.Sleep(100 * time.Millisecond) + time.Sleep(readBlockTime) pipe.Write(Frame{Payload: b}) }() b2 := make([]byte, len(b)) diff --git a/internal/multiplex/mux_test.go b/internal/multiplex/mux_test.go index 436c407..d3deaf9 100644 --- a/internal/multiplex/mux_test.go +++ b/internal/multiplex/mux_test.go @@ -12,6 +12,8 @@ import ( "time" ) +const eventualConsistencyTolerance = 500 * time.Millisecond + func serveEcho(l net.Listener) { for { conn, err := l.Accept() @@ -111,6 +113,8 @@ func TestMultiplex(t *testing.T) { //test echo runEchoTest(t, streams, maxMsgLen) + + time.Sleep(eventualConsistencyTolerance) if clientSession.streamCount() != numStreams { t.Errorf("client stream count is wrong: %v", clientSession.streamCount()) } @@ -148,7 +152,7 @@ func TestMux_StreamClosing(t *testing.T) { t.Errorf("can't write to stream: %v", err) } - time.Sleep(500 * time.Millisecond) + time.Sleep(eventualConsistencyTolerance) _ = toBeClosed.Close() _, err = io.ReadFull(toBeClosed, recvBuf) if err != nil { diff --git a/internal/multiplex/session_test.go b/internal/multiplex/session_test.go index 52fe6a5..79d62b5 100644 --- a/internal/multiplex/session_test.go +++ b/internal/multiplex/session_test.go @@ -408,7 +408,7 @@ func TestSession_timeoutAfter(t *testing.T) { seshConfigOrdered.Obfuscator = obfuscator seshConfigOrdered.InactivityTimeout = 100 * time.Millisecond sesh := MakeSession(0, seshConfigOrdered) - time.Sleep(200 * time.Millisecond) + time.Sleep(2 * seshConfigOrdered.InactivityTimeout) if !sesh.IsClosed() { t.Error("session should have timed out") } diff --git a/internal/multiplex/streamBufferedPipe_test.go b/internal/multiplex/streamBufferedPipe_test.go index dcaad29..ff0ec24 100644 --- a/internal/multiplex/streamBufferedPipe_test.go +++ b/internal/multiplex/streamBufferedPipe_test.go @@ -7,6 +7,8 @@ import ( "time" ) +const readBlockTime = 500 * time.Millisecond + func TestPipeRW(t *testing.T) { pipe := NewStreamBufferedPipe() b := []byte{0x01, 0x02, 0x03} @@ -60,7 +62,7 @@ func TestReadBlock(t *testing.T) { pipe := NewStreamBufferedPipe() b := []byte{0x01, 0x02, 0x03} go func() { - time.Sleep(100 * time.Millisecond) + time.Sleep(readBlockTime) pipe.Write(b) }() b2 := make([]byte, len(b)) diff --git a/internal/multiplex/stream_test.go b/internal/multiplex/stream_test.go index 278082b..9527034 100644 --- a/internal/multiplex/stream_test.go +++ b/internal/multiplex/stream_test.go @@ -230,7 +230,7 @@ func TestStream_Close(t *testing.T) { if err != nil { t.Errorf("can't read residual data %v", err) } - time.Sleep(100 * time.Millisecond) + time.Sleep(eventualConsistencyTolerance) if sI, _ := sesh.streams.Load(stream.(*Stream).id); sI != nil { t.Error("stream still exists") return diff --git a/internal/multiplex/switchboard_test.go b/internal/multiplex/switchboard_test.go index e052b55..01d55ae 100644 --- a/internal/multiplex/switchboard_test.go +++ b/internal/multiplex/switchboard_test.go @@ -145,7 +145,7 @@ func TestSwitchboard_CloseOnOneDisconn(t *testing.T) { sesh.AddConnection(conn1client) conn0server.Close() - time.Sleep(500 * time.Millisecond) + time.Sleep(eventualConsistencyTolerance) if !sesh.IsClosed() { t.Error("session not closed after one conn is disconnected") return @@ -178,7 +178,7 @@ func TestSwitchboard_ConnsCount(t *testing.T) { sesh.sb.closeAll() - time.Sleep(500 * time.Millisecond) + time.Sleep(eventualConsistencyTolerance) if sesh.sb.connsCount() != 0 { t.Error("connsCount incorrect") }