From 0a5a6f156e02ee34d3ead176542e72de5c541954 Mon Sep 17 00:00:00 2001 From: backkem Date: Mon, 6 Jan 2020 20:44:03 +0100 Subject: [PATCH] Use default test suite. --- go.mod | 1 - go.sum | 2 -- transport_test.go | 59 -------------------------------------------- webrtcdirect_test.go | 5 ++-- 4 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 transport_test.go diff --git a/go.mod b/go.mod index 1818552..9b48b53 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.12 require ( 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-mplex v0.2.1 github.com/libp2p/go-libp2p-testing v0.1.1 diff --git a/go.sum b/go.sum index 5d7e5ab..e611d79 100644 --- a/go.sum +++ b/go.sum @@ -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/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA= 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/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY= github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10= diff --git a/transport_test.go b/transport_test.go deleted file mode 100644 index 352d291..0000000 --- a/transport_test.go +++ /dev/null @@ -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) - }) - } -} diff --git a/webrtcdirect_test.go b/webrtcdirect_test.go index bbd39a6..0dca99f 100644 --- a/webrtcdirect_test.go +++ b/webrtcdirect_test.go @@ -6,6 +6,7 @@ import ( logging "github.com/ipfs/go-log" mplex "github.com/libp2p/go-libp2p-mplex" + utils "github.com/libp2p/go-libp2p-testing/suites/transport" ma "github.com/multiformats/go-multiaddr" "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" - // TODO: Re-enable normal test suite when not hitting CI limits when using race detector - // utils.SubtestTransport(t, ta, tb, addr, "peerA") - SubtestTransport(t, ta, tb, addr, "peerA") + utils.SubtestTransport(t, ta, tb, addr, "peerA") } func TestTransportCantListenUtp(t *testing.T) {