mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-29 10:05:16 +00:00
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
package ttransport
|
|
|
|
import (
|
|
"reflect"
|
|
"runtime"
|
|
"testing"
|
|
|
|
"github.com/libp2p/go-libp2p/core/peer"
|
|
"github.com/libp2p/go-libp2p/core/transport"
|
|
|
|
ma "github.com/multiformats/go-multiaddr"
|
|
)
|
|
|
|
var Subtests = []func(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr, peerA peer.ID){
|
|
SubtestProtocols,
|
|
SubtestBasic,
|
|
SubtestCancel,
|
|
SubtestPingPong,
|
|
|
|
// Stolen from the stream muxer test suite.
|
|
SubtestStress1Conn1Stream1Msg,
|
|
SubtestStress1Conn1Stream100Msg,
|
|
SubtestStress1Conn100Stream100Msg,
|
|
SubtestStressManyConn10Stream50Msg,
|
|
SubtestStress1Conn1000Stream10Msg,
|
|
SubtestStress1Conn100Stream100Msg10MB,
|
|
SubtestStreamOpenStress,
|
|
SubtestStreamReset,
|
|
}
|
|
|
|
func getFunctionName(i interface{}) string {
|
|
return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
|
|
}
|
|
|
|
func SubtestTransport(t *testing.T, ta, tb transport.Transport, addr string, peerA peer.ID) {
|
|
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)
|
|
})
|
|
}
|
|
}
|