Use default test suite.

This commit is contained in:
backkem 2020-01-06 20:44:03 +01:00
parent 2b84177506
commit 0a5a6f156e
4 changed files with 2 additions and 65 deletions

1
go.mod
View File

@ -4,7 +4,6 @@ go 1.12
require ( require (
github.com/ipfs/go-log v1.0.0 github.com/ipfs/go-log v1.0.0
github.com/jbenet/go-detect-race v0.0.0-20150302022421-3463798d9574
github.com/libp2p/go-libp2p-core v0.3.0 github.com/libp2p/go-libp2p-core v0.3.0
github.com/libp2p/go-libp2p-mplex v0.2.1 github.com/libp2p/go-libp2p-mplex v0.2.1
github.com/libp2p/go-libp2p-testing v0.1.1 github.com/libp2p/go-libp2p-testing v0.1.1

2
go.sum
View File

@ -57,8 +57,6 @@ github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9
github.com/ipfs/go-log v1.0.0 h1:BW3LQIiZzpNyolt84yvKNCd3FU+AK4VDw1hnHR+1aiI= github.com/ipfs/go-log v1.0.0 h1:BW3LQIiZzpNyolt84yvKNCd3FU+AK4VDw1hnHR+1aiI=
github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA= github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA=
github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA= github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
github.com/jbenet/go-detect-race v0.0.0-20150302022421-3463798d9574 h1:Pxjl8Wn3cCU7nB/MCmPEUMbjMHxXFqODW6rce0jpxB4=
github.com/jbenet/go-detect-race v0.0.0-20150302022421-3463798d9574/go.mod h1:gynVu6LUw+xMXD3XEvjHQcIbJkWEamnGjJDebRHqTd0=
github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8 h1:bspPhN+oKYFk5fcGNuQzp6IGzYQSenLEgH3s6jkXrWw=
github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY=
github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10=

View File

@ -1,59 +0,0 @@
package libp2pwebrtcdirect
import (
"reflect"
"runtime"
"testing"
detectrace "github.com/jbenet/go-detect-race"
peer "github.com/libp2p/go-libp2p-core/peer"
tpt "github.com/libp2p/go-libp2p-core/transport"
ttransport "github.com/libp2p/go-libp2p-testing/suites/transport"
ma "github.com/multiformats/go-multiaddr"
)
// The contents of this file are copied from libp2p/go-libp2p-core/transport/test
// in order to disable some tests while we investigate performance issues when
// running the tests on resource restricted environments like the Travis CI.
func getFunctionName(i interface{}) string {
return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
}
func SubtestTransport(t *testing.T, ta, tb tpt.Transport, addr string, peerA peer.ID) {
subtests := []func(t *testing.T, ta, tb tpt.Transport, maddr ma.Multiaddr, peerA peer.ID){}
if detectrace.WithRace() {
subtests = []func(t *testing.T, ta, tb tpt.Transport, maddr ma.Multiaddr, peerA peer.ID){
ttransport.SubtestProtocols,
ttransport.SubtestBasic,
ttransport.SubtestCancel,
ttransport.SubtestPingPong,
// Stolen from the stream muxer test suite.
ttransport.SubtestStress1Conn1Stream1Msg,
}
} else {
subtests = []func(t *testing.T, ta, tb tpt.Transport, maddr ma.Multiaddr, peerA peer.ID){
ttransport.SubtestStress1Conn1Stream100Msg,
ttransport.SubtestStress1Conn100Stream100Msg,
ttransport.SubtestStress50Conn10Stream50Msg,
ttransport.SubtestStress1Conn1000Stream10Msg,
ttransport.SubtestStress1Conn100Stream100Msg10MB,
ttransport.SubtestStreamOpenStress,
ttransport.SubtestStreamReset,
}
}
maddr, err := ma.NewMultiaddr(addr)
if err != nil {
t.Fatal(err)
}
for _, f := range subtests {
t.Run(getFunctionName(f), func(t *testing.T) {
f(t, ta, tb, maddr, peerA)
})
}
}

View File

@ -6,6 +6,7 @@ import (
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
mplex "github.com/libp2p/go-libp2p-mplex" mplex "github.com/libp2p/go-libp2p-mplex"
utils "github.com/libp2p/go-libp2p-testing/suites/transport"
ma "github.com/multiformats/go-multiaddr" ma "github.com/multiformats/go-multiaddr"
"github.com/pion/webrtc/v2" "github.com/pion/webrtc/v2"
) )
@ -24,9 +25,7 @@ func TestTransport(t *testing.T) {
addr := "/ip4/127.0.0.1/tcp/0/http/p2p-webrtc-direct" addr := "/ip4/127.0.0.1/tcp/0/http/p2p-webrtc-direct"
// TODO: Re-enable normal test suite when not hitting CI limits when using race detector utils.SubtestTransport(t, ta, tb, addr, "peerA")
// utils.SubtestTransport(t, ta, tb, addr, "peerA")
SubtestTransport(t, ta, tb, addr, "peerA")
} }
func TestTransportCantListenUtp(t *testing.T) { func TestTransportCantListenUtp(t *testing.T) {