Skip to content

Commit

Permalink
test: Increase disconnectTimeout to reduce test flakes (#26)
Browse files Browse the repository at this point in the history
* test: Increase disconnectTimeout to reduce test flakes

WebRTC uses UDP, which means a network connection is never open or closed. It uses timeouts to determine connection state; on a slow CI runner, these timeouts could be reached. Increasing this timeout should reduce flakes, but is unlikely to remove this flake entirely.

* Fix close after offline

* Run tests in parallel
  • Loading branch information
kylecarbs committed Jan 14, 2022
1 parent 423611b commit a461bc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
- run:
gotestsum --jsonfile="gotests.json" --packages="./..." --
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m
-count=3 -race
-count=3 -race -parallel=2

- uses: codecov/codecov-action@v2
with:
Expand Down
5 changes: 4 additions & 1 deletion peer/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

const (
disconnectedTimeout = time.Millisecond * 200
disconnectedTimeout = time.Second
failedTimeout = disconnectedTimeout * 5
keepAliveInterval = time.Millisecond * 2
)
Expand Down Expand Up @@ -89,6 +89,7 @@ func TestConn(t *testing.T) {

sch, err := server.Accept(context.Background())
require.NoError(t, err)
defer sch.Close()

_ = cch.Close()
_, err = sch.Read(make([]byte, 4))
Expand All @@ -102,6 +103,7 @@ func TestConn(t *testing.T) {
require.NoError(t, err)
sch, err := server.Accept(context.Background())
require.NoError(t, err)
defer sch.Close()

err = wan.Stop()
require.NoError(t, err)
Expand All @@ -117,6 +119,7 @@ func TestConn(t *testing.T) {
require.NoError(t, err)
sch, err := server.Accept(context.Background())
require.NoError(t, err)
defer sch.Close()
go func() {
for i := 0; i < 1024; i++ {
_, err := cch.Write(make([]byte, 4096))
Expand Down

0 comments on commit a461bc1

Please sign in to comment.