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
f1f32933
Commit
f1f32933
authored
Jun 10, 2016
by
Jeromy Johnson
Committed by
GitHub
Jun 10, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2831 from ipfs/feature/test-stanity
Add some sanity tests for the misdial failure
parents
4d542cbb
3e1ec617
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
dht_test.go
dht_test.go
+14
-0
No files found.
dht_test.go
View file @
f1f32933
...
...
@@ -56,10 +56,24 @@ func setupDHTS(ctx context.Context, n int, t *testing.T) ([]ma.Multiaddr, []peer
dhts
:=
make
([]
*
IpfsDHT
,
n
)
peers
:=
make
([]
peer
.
ID
,
n
)
sanityAddrsMap
:=
make
(
map
[
string
]
struct
{})
sanityPeersMap
:=
make
(
map
[
string
]
struct
{})
for
i
:=
0
;
i
<
n
;
i
++
{
dhts
[
i
]
=
setupDHT
(
ctx
,
t
)
peers
[
i
]
=
dhts
[
i
]
.
self
addrs
[
i
]
=
dhts
[
i
]
.
peerstore
.
Addrs
(
dhts
[
i
]
.
self
)[
0
]
if
_
,
lol
:=
sanityAddrsMap
[
addrs
[
i
]
.
String
()];
lol
{
t
.
Fatal
(
"While setting up DHTs address got duplicated."
)
}
else
{
sanityAddrsMap
[
addrs
[
i
]
.
String
()]
=
struct
{}{}
}
if
_
,
lol
:=
sanityPeersMap
[
peers
[
i
]
.
String
()];
lol
{
t
.
Fatal
(
"While setting up DHTs peerid got duplicated."
)
}
else
{
sanityPeersMap
[
peers
[
i
]
.
String
()]
=
struct
{}{}
}
}
return
addrs
,
peers
,
dhts
...
...
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