Commit f1f32933 authored by Jeromy Johnson's avatar Jeromy Johnson Committed by GitHub

Merge pull request #2831 from ipfs/feature/test-stanity

Add some sanity tests for the misdial failure
parents 4d542cbb 3e1ec617
...@@ -56,10 +56,24 @@ func setupDHTS(ctx context.Context, n int, t *testing.T) ([]ma.Multiaddr, []peer ...@@ -56,10 +56,24 @@ func setupDHTS(ctx context.Context, n int, t *testing.T) ([]ma.Multiaddr, []peer
dhts := make([]*IpfsDHT, n) dhts := make([]*IpfsDHT, n)
peers := make([]peer.ID, n) peers := make([]peer.ID, n)
sanityAddrsMap := make(map[string]struct{})
sanityPeersMap := make(map[string]struct{})
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
dhts[i] = setupDHT(ctx, t) dhts[i] = setupDHT(ctx, t)
peers[i] = dhts[i].self peers[i] = dhts[i].self
addrs[i] = dhts[i].peerstore.Addrs(dhts[i].self)[0] 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 return addrs, peers, dhts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment