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
dms3
go-dms3-routing
Commits
32cb5e94
Commit
32cb5e94
authored
Nov 20, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dht tests: dont introduce nil multiaddr
this is the type of assumption we shouldn't violate.
parent
80effbe5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
dht/dht_test.go
dht/dht_test.go
+8
-0
dht/ext_test.go
dht/ext_test.go
+4
-4
No files found.
dht/dht_test.go
View file @
32cb5e94
...
...
@@ -64,6 +64,14 @@ func setupDHTS(ctx context.Context, n int, t *testing.T) ([]ma.Multiaddr, []peer
return
addrs
,
peers
,
dhts
}
func
makePeerString
(
t
*
testing
.
T
,
addr
string
)
peer
.
Peer
{
maddr
,
err
:=
ma
.
NewMultiaddr
(
addr
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
return
makePeer
(
maddr
)
}
func
makePeer
(
addr
ma
.
Multiaddr
)
peer
.
Peer
{
sk
,
pk
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
512
)
if
err
!=
nil
{
...
...
dht/ext_test.go
View file @
32cb5e94
...
...
@@ -125,10 +125,10 @@ func TestGetFailures(t *testing.T) {
fs
:=
&
fauxSender
{}
peerstore
:=
peer
.
NewPeerstore
()
local
:=
makePeer
(
nil
)
local
:=
makePeer
String
(
t
,
""
)
d
:=
NewDHT
(
ctx
,
local
,
peerstore
,
fn
,
fs
,
ds
.
NewMapDatastore
())
other
:=
makePeer
(
nil
)
other
:=
makePeer
String
(
t
,
""
)
d
.
Update
(
ctx
,
other
)
// This one should time out
...
...
@@ -223,7 +223,7 @@ func TestNotFound(t *testing.T) {
fn
:=
&
fauxNet
{}
fs
:=
&
fauxSender
{}
local
:=
makePeer
(
nil
)
local
:=
makePeer
String
(
t
,
""
)
peerstore
:=
peer
.
NewPeerstore
()
peerstore
.
Add
(
local
)
...
...
@@ -289,7 +289,7 @@ func TestLessThanKResponses(t *testing.T) {
u
.
Debug
=
false
fn
:=
&
fauxNet
{}
fs
:=
&
fauxSender
{}
local
:=
makePeer
(
nil
)
local
:=
makePeer
String
(
t
,
""
)
peerstore
:=
peer
.
NewPeerstore
()
peerstore
.
Add
(
local
)
...
...
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