Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some sanity tests for the misdial failure #2831

Merged
merged 2 commits into from
Jun 10, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add some sanity tests for the misdial failure
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Jun 9, 2016
commit a84006a24c3c41928db902f8905cd962cf37c2b2
14 changes: 14 additions & 0 deletions routing/dht/dht_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 dumplicated.")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dumplicated ..... 😸

} else {
sanityAddrsMap[addrs[i].String()] = struct{}{}
}
if _, lol := sanityPeersMap[peers[i].String()]; lol {
t.Fatal("While setting up DHTs peerid got dumplicated.")
} else {
sanityPeersMap[peers[i].String()] = struct{}{}
}
}

return addrs, peers, dhts
Expand Down