Browse Source

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

* Only run the 50 connection test on linux

* Only one stress test on linux instead of both
pull/1506/head
Marco Munizaga 3 years ago
committed by GitHub
parent
commit
b5289f13bb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      p2p/transport/testsuite/stream_suite.go
  2. 3
      p2p/transport/testsuite/utils_suite.go

11
p2p/transport/testsuite/stream_suite.go

@ -7,6 +7,7 @@ import (
"io"
"io/ioutil"
"os"
"runtime"
"strconv"
"sync"
"testing"
@ -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,

3
p2p/transport/testsuite/utils_suite.go

@ -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,
@ -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)

Loading…
Cancel
Save