Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-kad-dht
Commits
cf507327
Commit
cf507327
authored
Jan 02, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up test setup interface
parent
f57104bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
dht_test.go
dht_test.go
+9
-9
No files found.
dht_test.go
View file @
cf507327
...
...
@@ -32,9 +32,9 @@ func init() {
}
}
func setupDHT(ctx context.Context, t *testing.T, addr ma.Multiaddr
, seed int64
) *IpfsDHT {
func
setupDHT
(
ctx
context
.
Context
,
t
*
testing
.
T
,
addr
ma
.
Multiaddr
)
*
IpfsDHT
{
sk, pk, err := testutil.SeededKeyPair(
512, seed
)
sk
,
pk
,
err
:=
testutil
.
SeededKeyPair
(
time
.
Now
()
.
UnixNano
()
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -70,7 +70,7 @@ func setupDHTS(ctx context.Context, n int, t *testing.T) ([]ma.Multiaddr, []peer
for
i
:=
0
;
i
<
n
;
i
++
{
addrs
[
i
]
=
testutil
.
RandLocalTCPAddress
()
dhts[i] = setupDHT(ctx, t, addrs[i]
, int64(i)
)
dhts
[
i
]
=
setupDHT
(
ctx
,
t
,
addrs
[
i
])
peers
[
i
]
=
dhts
[
i
]
.
self
}
...
...
@@ -119,8 +119,8 @@ func TestPing(t *testing.T) {
addrA
:=
testutil
.
RandLocalTCPAddress
()
addrB
:=
testutil
.
RandLocalTCPAddress
()
dhtA := setupDHT(ctx, t, addrA
, 1
)
dhtB := setupDHT(ctx, t, addrB
, 2
)
dhtA
:=
setupDHT
(
ctx
,
t
,
addrA
)
dhtB
:=
setupDHT
(
ctx
,
t
,
addrB
)
peerA
:=
dhtA
.
self
peerB
:=
dhtB
.
self
...
...
@@ -152,8 +152,8 @@ func TestValueGetSet(t *testing.T) {
addrA
:=
testutil
.
RandLocalTCPAddress
()
addrB
:=
testutil
.
RandLocalTCPAddress
()
dhtA := setupDHT(ctx, t, addrA
, 1
)
dhtB := setupDHT(ctx, t, addrB
, 2
)
dhtA
:=
setupDHT
(
ctx
,
t
,
addrA
)
dhtB
:=
setupDHT
(
ctx
,
t
,
addrB
)
defer
dhtA
.
Close
()
defer
dhtB
.
Close
()
...
...
@@ -636,8 +636,8 @@ func TestConnectCollision(t *testing.T) {
addrA
:=
testutil
.
RandLocalTCPAddress
()
addrB
:=
testutil
.
RandLocalTCPAddress
()
dhtA := setupDHT(ctx, t, addrA
, int64((rtime*2)+1)
)
dhtB := setupDHT(ctx, t, addrB
, int64((rtime*2)+2)
)
dhtA
:=
setupDHT
(
ctx
,
t
,
addrA
)
dhtB
:=
setupDHT
(
ctx
,
t
,
addrB
)
peerA
:=
dhtA
.
self
peerB
:=
dhtB
.
self
...
...
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