Commit 32cb5e94 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

dht tests: dont introduce nil multiaddr

this is the type of assumption we shouldn't violate.
parent 80effbe5
......@@ -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 {
......
......@@ -125,10 +125,10 @@ func TestGetFailures(t *testing.T) {
fs := &fauxSender{}
peerstore := peer.NewPeerstore()
local := makePeer(nil)
local := makePeerString(t, "")
d := NewDHT(ctx, local, peerstore, fn, fs, ds.NewMapDatastore())
other := makePeer(nil)
other := makePeerString(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 := makePeerString(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 := makePeerString(t, "")
peerstore := peer.NewPeerstore()
peerstore.Add(local)
......
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