Skip to content

Commit

Permalink
tcp: limit the number of connections in tcp suite test on non-linux h…
Browse files Browse the repository at this point in the history
…osts (#1507)

* Only run the 50 connection test on linux

* Only one stress test on linux instead of both
  • Loading branch information
MarcoPolo authored May 18, 2022
1 parent 9538154 commit b5289f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions p2p/transport/testsuite/stream_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"io/ioutil"
"os"
"runtime"
"strconv"
"sync"
"testing"
Expand Down Expand Up @@ -417,9 +418,15 @@ func SubtestStress1Conn100Stream100Msg(t *testing.T, ta, tb transport.Transport,
})
}

func SubtestStress50Conn10Stream50Msg(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr, peerA peer.ID) {
func SubtestStressManyConn10Stream50Msg(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr, peerA peer.ID) {
connNum := 5
if runtime.GOOS == "linux" {
// Linux can handle a higher number of conns here than other platforms in CI.
// See https://github.com/libp2p/go-libp2p/issues/1498.
connNum = 50
}
SubtestStress(t, ta, tb, maddr, peerA, Options{
ConnNum: 50,
ConnNum: connNum,
StreamNum: 10,
MsgNum: 50,
MsgMax: 100,
Expand Down
3 changes: 2 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,
SubtestStressManyConn10Stream50Msg,
SubtestStress1Conn1000Stream10Msg,
SubtestStress1Conn100Stream100Msg10MB,
SubtestStreamOpenStress,
Expand All @@ -37,6 +37,7 @@ func SubtestTransport(t *testing.T, ta, tb transport.Transport, addr string, pee
if err != nil {
t.Fatal(err)
}

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

0 comments on commit b5289f1

Please sign in to comment.