Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
48e0effd
Commit
48e0effd
authored
Oct 19, 2018
by
vyzo
Browse files
resolve import cycle in ping test
parent
1056fa81
Changes
1
Hide whitespace changes
Inline
Side-by-side
p2p/protocol/ping/ping_test.go
View file @
48e0effd
package
ping
package
ping
_test
import
(
"context"
...
...
@@ -9,6 +9,7 @@ import (
pstore
"github.com/libp2p/go-libp2p-peerstore"
swarmt
"github.com/libp2p/go-libp2p-swarm/testing"
bhost
"github.com/libp2p/go-libp2p/p2p/host/basic"
ping
"github.com/libp2p/go-libp2p/p2p/protocol/ping"
)
func
TestPing
(
t
*
testing
.
T
)
{
...
...
@@ -26,14 +27,14 @@ func TestPing(t *testing.T) {
t
.
Fatal
(
err
)
}
ps1
:=
NewPingService
(
h1
)
ps2
:=
NewPingService
(
h2
)
ps1
:=
ping
.
NewPingService
(
h1
)
ps2
:=
ping
.
NewPingService
(
h2
)
testPing
(
t
,
ps1
,
h2
.
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
())
defer
cancel
()
ts
,
err
:=
ps
.
Ping
(
pctx
,
p
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment