Marten Seemann
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
3 deletions
-
p2p/protocol/ping/ping_test.go
|
|
@ -5,13 +5,14 @@ import ( |
|
|
|
"testing" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/stretchr/testify/require" |
|
|
|
|
|
|
|
bhost "github.com/libp2p/go-libp2p/p2p/host/basic" |
|
|
|
swarmt "github.com/libp2p/go-libp2p/p2p/net/swarm/testing" |
|
|
|
"github.com/libp2p/go-libp2p/p2p/protocol/ping" |
|
|
|
|
|
|
|
"github.com/libp2p/go-libp2p-core/peer" |
|
|
|
|
|
|
|
ma "github.com/multiformats/go-multiaddr" |
|
|
|
"github.com/stretchr/testify/require" |
|
|
|
) |
|
|
|
|
|
|
|
func TestPing(t *testing.T) { |
|
|
@ -19,12 +20,14 @@ func TestPing(t *testing.T) { |
|
|
|
defer cancel() |
|
|
|
h1, err := bhost.NewHost(swarmt.GenSwarm(t), nil) |
|
|
|
require.NoError(t, err) |
|
|
|
defer h1.Close() |
|
|
|
h2, err := bhost.NewHost(swarmt.GenSwarm(t), nil) |
|
|
|
require.NoError(t, err) |
|
|
|
defer h2.Close() |
|
|
|
|
|
|
|
err = h1.Connect(ctx, peer.AddrInfo{ |
|
|
|
ID: h2.ID(), |
|
|
|
Addrs: h2.Addrs(), |
|
|
|
Addrs: []ma.Multiaddr{h2.Addrs()[0]}, |
|
|
|
}) |
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|