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
74bffeb3
Commit
74bffeb3
authored
Dec 17, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transition dht to mock2
parent
1044b968
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
24 deletions
+15
-24
ext_test.go
ext_test.go
+15
-24
No files found.
ext_test.go
View file @
74bffeb3
...
...
@@ -7,15 +7,15 @@ import (
crand
"crypto/rand"
inet
"github.com/jbenet/go-ipfs/net"
mocknet
"github.com/jbenet/go-ipfs/net/mock"
mocknet
"github.com/jbenet/go-ipfs/net/mock
2
"
peer
"github.com/jbenet/go-ipfs/peer"
routing
"github.com/jbenet/go-ipfs/routing"
pb
"github.com/jbenet/go-ipfs/routing/dht/pb"
u
"github.com/jbenet/go-ipfs/util"
testutil
"github.com/jbenet/go-ipfs/util/testutil"
ggio
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/io"
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ggio
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/io"
ds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
"time"
...
...
@@ -27,16 +27,15 @@ func TestGetFailures(t *testing.T) {
}
ctx
:=
context
.
Background
()
peerstore
:=
peer
.
NewPeerstore
()
local
:=
makePeerString
(
t
,
""
)
peers
:=
[]
peer
.
Peer
{
local
,
testutil
.
RandPeer
()}
nets
,
err
:=
mocknet
.
MakeNetworks
(
ctx
,
peers
)
mn
,
err
:=
mocknet
.
FullMeshConnected
(
ctx
,
2
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
nets
:=
mn
.
Nets
()
peers
:=
mn
.
Peers
()
d
:=
NewDHT
(
ctx
,
peers
[
0
],
peerstore
,
nets
[
0
],
ds
.
NewMapDatastore
())
ps
:=
peer
.
NewPeerstore
()
d
:=
NewDHT
(
ctx
,
peers
[
0
],
ps
,
nets
[
0
],
ds
.
NewMapDatastore
())
d
.
Update
(
ctx
,
peers
[
1
])
// This one should time out
...
...
@@ -141,17 +140,13 @@ func TestNotFound(t *testing.T) {
}
ctx
:=
context
.
Background
()
peerstore
:=
peer
.
NewPeerstore
()
var
peers
[]
peer
.
Peer
for
i
:=
0
;
i
<
16
;
i
++
{
peers
=
append
(
peers
,
testutil
.
RandPeer
())
}
nets
,
err
:=
mocknet
.
MakeNetworks
(
ctx
,
peers
)
mn
,
err
:=
mocknet
.
FullMeshConnected
(
ctx
,
16
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
nets
:=
mn
.
Nets
()
peers
:=
mn
.
Peers
()
peerstore
:=
peer
.
NewPeerstore
()
d
:=
NewDHT
(
ctx
,
peers
[
0
],
peerstore
,
nets
[
0
],
ds
.
NewMapDatastore
())
...
...
@@ -215,17 +210,13 @@ func TestLessThanKResponses(t *testing.T) {
// t.Skip("skipping test because it makes a lot of output")
ctx
:=
context
.
Background
()
peerstore
:=
peer
.
NewPeerstore
()
var
peers
[]
peer
.
Peer
for
i
:=
0
;
i
<
6
;
i
++
{
peers
=
append
(
peers
,
testutil
.
RandPeer
())
}
nets
,
err
:=
mocknet
.
MakeNetworks
(
ctx
,
peers
)
mn
,
err
:=
mocknet
.
FullMeshConnected
(
ctx
,
6
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
nets
:=
mn
.
Nets
()
peers
:=
mn
.
Peers
()
peerstore
:=
peer
.
NewPeerstore
()
d
:=
NewDHT
(
ctx
,
peers
[
0
],
peerstore
,
nets
[
0
],
ds
.
NewMapDatastore
())
...
...
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