Browse Source

use yamux instead of mplex in tests (#1456)

* use yamux in TCP transport tests

* use yamux in websocket tests
pull/1461/head
Marten Seemann 3 years ago
committed by GitHub
parent
commit
94ce988fbb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      go.mod
  2. 12
      p2p/transport/tcp/tcp_test.go
  3. 4
      p2p/transport/websocket/websocket_test.go

2
go.mod

@ -20,7 +20,6 @@ require (
github.com/libp2p/go-libp2p-asn-util v0.1.0
github.com/libp2p/go-libp2p-circuit v0.6.0
github.com/libp2p/go-libp2p-core v0.15.1
github.com/libp2p/go-libp2p-mplex v0.5.0
github.com/libp2p/go-libp2p-nat v0.1.0
github.com/libp2p/go-libp2p-noise v0.4.0
github.com/libp2p/go-libp2p-peerstore v0.6.0
@ -86,7 +85,6 @@ require (
github.com/libp2p/go-libp2p-quic-transport v0.17.0 // indirect
github.com/libp2p/go-libp2p-swarm v0.10.2 // indirect
github.com/libp2p/go-libp2p-yamux v0.9.1 // indirect
github.com/libp2p/go-mplex v0.4.0 // indirect
github.com/libp2p/go-nat v0.1.0 // indirect
github.com/libp2p/go-openssl v0.0.7 // indirect
github.com/libp2p/go-tcp-transport v0.5.1 // indirect

12
p2p/transport/tcp/tcp_test.go

@ -5,16 +5,16 @@ import (
"errors"
"testing"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p/p2p/muxer/yamux"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/sec"
"github.com/libp2p/go-libp2p-core/sec/insecure"
"github.com/libp2p/go-libp2p-core/transport"
csms "github.com/libp2p/go-conn-security-multistream"
mplex "github.com/libp2p/go-libp2p-mplex"
mocknetwork "github.com/libp2p/go-libp2p-testing/mocks/network"
ttransport "github.com/libp2p/go-libp2p-testing/suites/transport"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
@ -30,11 +30,11 @@ func TestTcpTransport(t *testing.T) {
peerA, ia := makeInsecureMuxer(t)
_, ib := makeInsecureMuxer(t)
ua, err := tptu.New(ia, new(mplex.Transport))
ua, err := tptu.New(ia, yamux.DefaultTransport)
require.NoError(t, err)
ta, err := NewTCPTransport(ua, nil)
require.NoError(t, err)
ub, err := tptu.New(ib, new(mplex.Transport))
ub, err := tptu.New(ib, yamux.DefaultTransport)
require.NoError(t, err)
tb, err := NewTCPTransport(ub, nil)
require.NoError(t, err)
@ -54,7 +54,7 @@ func TestResourceManager(t *testing.T) {
peerA, ia := makeInsecureMuxer(t)
_, ib := makeInsecureMuxer(t)
ua, err := tptu.New(ia, new(mplex.Transport))
ua, err := tptu.New(ia, yamux.DefaultTransport)
require.NoError(t, err)
ta, err := NewTCPTransport(ua, nil)
require.NoError(t, err)
@ -62,7 +62,7 @@ func TestResourceManager(t *testing.T) {
require.NoError(t, err)
defer ln.Close()
ub, err := tptu.New(ib, new(mplex.Transport))
ub, err := tptu.New(ib, yamux.DefaultTransport)
require.NoError(t, err)
rcmgr := mocknetwork.NewMockResourceManager(ctrl)
tb, err := NewTCPTransport(ub, rcmgr)

4
p2p/transport/websocket/websocket_test.go

@ -22,9 +22,9 @@ import (
"github.com/libp2p/go-libp2p-core/sec/insecure"
"github.com/libp2p/go-libp2p-core/test"
"github.com/libp2p/go-libp2p-core/transport"
"github.com/libp2p/go-libp2p/p2p/muxer/yamux"
csms "github.com/libp2p/go-conn-security-multistream"
mplex "github.com/libp2p/go-libp2p-mplex"
ttransport "github.com/libp2p/go-libp2p-testing/suites/transport"
tptu "github.com/libp2p/go-libp2p-transport-upgrader"
@ -35,7 +35,7 @@ import (
func newUpgrader(t *testing.T) (peer.ID, transport.Upgrader) {
t.Helper()
id, m := newSecureMuxer(t)
u, err := tptu.New(m, new(mplex.Transport))
u, err := tptu.New(m, yamux.DefaultTransport)
if err != nil {
t.Fatal(err)
}

Loading…
Cancel
Save