Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcp: limit the number of connections in tcp suite test on non-linux hosts #1507

Merged
merged 2 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions p2p/transport/testsuite/stream_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,16 @@ func SubtestStress50Conn10Stream50Msg(t *testing.T, ta, tb transport.Transport,
})
}

func SubtestStress5Conn10Stream50Msg(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr, peerA peer.ID) {
SubtestStress(t, ta, tb, maddr, peerA, Options{
ConnNum: 5,
StreamNum: 10,
MsgNum: 50,
MsgMax: 100,
MsgMin: 100,
})
}

func SubtestStress1Conn1000Stream10Msg(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr, peerA peer.ID) {
SubtestStress(t, ta, tb, maddr, peerA, Options{
ConnNum: 1,
Expand Down
10 changes: 9 additions & 1 deletion p2p/transport/testsuite/utils_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var Subtests = []func(t *testing.T, ta, tb transport.Transport, maddr ma.Multiad
SubtestStress1Conn1Stream1Msg,
SubtestStress1Conn1Stream100Msg,
SubtestStress1Conn100Stream100Msg,
SubtestStress50Conn10Stream50Msg,
SubtestStress5Conn10Stream50Msg,
SubtestStress1Conn1000Stream10Msg,
SubtestStress1Conn100Stream100Msg10MB,
SubtestStreamOpenStress,
Expand All @@ -37,6 +37,14 @@ func SubtestTransport(t *testing.T, ta, tb transport.Transport, addr string, pee
if err != nil {
t.Fatal(err)
}

if runtime.GOOS == "linux" {
// Only run this test on Linux since macOS runs into buffering issues on CI
// with this many connections. See
// https://github.com/libp2p/go-libp2p/issues/1498.
Subtests = append(Subtests, SubtestStress50Conn10Stream50Msg)
}

for _, f := range Subtests {
t.Run(getFunctionName(f), func(t *testing.T) {
f(t, ta, tb, maddr, peerA)
Expand Down