Commit 48e0effd authored by vyzo's avatar vyzo
Browse files

resolve import cycle in ping test

parent 1056fa81
package ping package ping_test
import ( import (
"context" "context"
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
pstore "github.com/libp2p/go-libp2p-peerstore" pstore "github.com/libp2p/go-libp2p-peerstore"
swarmt "github.com/libp2p/go-libp2p-swarm/testing" swarmt "github.com/libp2p/go-libp2p-swarm/testing"
bhost "github.com/libp2p/go-libp2p/p2p/host/basic" bhost "github.com/libp2p/go-libp2p/p2p/host/basic"
ping "github.com/libp2p/go-libp2p/p2p/protocol/ping"
) )
func TestPing(t *testing.T) { func TestPing(t *testing.T) {
...@@ -26,14 +27,14 @@ func TestPing(t *testing.T) { ...@@ -26,14 +27,14 @@ func TestPing(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
ps1 := NewPingService(h1) ps1 := ping.NewPingService(h1)
ps2 := NewPingService(h2) ps2 := ping.NewPingService(h2)
testPing(t, ps1, h2.ID()) testPing(t, ps1, h2.ID())
testPing(t, ps2, h1.ID()) testPing(t, ps2, h1.ID())
} }
func testPing(t *testing.T, ps *PingService, p peer.ID) { func testPing(t *testing.T, ps *ping.PingService, p peer.ID) {
pctx, cancel := context.WithCancel(context.Background()) pctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
ts, err := ps.Ping(pctx, p) ts, err := ps.Ping(pctx, p)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment