Skip to content

Commit 19b4545

Browse files
fix flaky reconnect test (#1406)
* don't run the reconnect test using TCP on OSX Due to golang/go#50254. * don't check the error return value when closing stream in reconnect test
1 parent fc2174c commit 19b4545

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

p2p/test/reconnects/reconnect_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"io"
66
"math/rand"
7+
"runtime"
78
"sync"
89
"testing"
910
"time"
@@ -49,6 +50,9 @@ func TestReconnect5(t *testing.T) {
4950
}
5051

5152
t.Run("using TCP", func(t *testing.T) {
53+
if runtime.GOOS == "darwin" {
54+
t.Skip("TCP RST handling is flaky in OSX, see https://github.com/golang/go/issues/50254")
55+
}
5256
runTest(t, swarmt.OptDisableQUIC)
5357
})
5458

@@ -91,9 +95,9 @@ func runRound(t *testing.T, hosts []host.Host) {
9195
rand.Read(data)
9296
str, err := h1.NewStream(context.Background(), h2.ID(), protocol.TestingID)
9397
require.NoError(t, err)
98+
defer str.Close()
9499
_, err = str.Write(data)
95100
require.NoError(t, err)
96-
require.NoError(t, str.Close())
97101
}()
98102
}
99103
wg.Wait()
@@ -121,5 +125,5 @@ func runRound(t *testing.T, hosts []host.Host) {
121125
}
122126
}
123127
return true
124-
}, 500*time.Millisecond, 10*time.Millisecond)
128+
}, 5000*time.Millisecond, 10*time.Millisecond)
125129
}

0 commit comments

Comments
 (0)