Skip to content

Commit a461bc1

Browse files
authored
test: Increase disconnectTimeout to reduce test flakes (#26)
* 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
1 parent 423611b commit a461bc1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.github/workflows/coder.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
- run:
131131
gotestsum --jsonfile="gotests.json" --packages="./..." --
132132
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m
133-
-count=3 -race
133+
-count=3 -race -parallel=2
134134

135135
- uses: codecov/codecov-action@v2
136136
with:

peer/conn_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
)
2424

2525
const (
26-
disconnectedTimeout = time.Millisecond * 200
26+
disconnectedTimeout = time.Second
2727
failedTimeout = disconnectedTimeout * 5
2828
keepAliveInterval = time.Millisecond * 2
2929
)
@@ -89,6 +89,7 @@ func TestConn(t *testing.T) {
8989

9090
sch, err := server.Accept(context.Background())
9191
require.NoError(t, err)
92+
defer sch.Close()
9293

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

106108
err = wan.Stop()
107109
require.NoError(t, err)
@@ -117,6 +119,7 @@ func TestConn(t *testing.T) {
117119
require.NoError(t, err)
118120
sch, err := server.Accept(context.Background())
119121
require.NoError(t, err)
122+
defer sch.Close()
120123
go func() {
121124
for i := 0; i < 1024; i++ {
122125
_, err := cch.Write(make([]byte, 4096))

0 commit comments

Comments
 (0)