Skip to content

Commit

Permalink
coreapi/dht: fix test panic
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
  • Loading branch information
magik6k committed Mar 30, 2018
1 parent 5f75628 commit 77f6604
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/coreapi/dht_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func TestDhtFindPeer(t *testing.T) {
ctx := context.Background()
nds, apis, err := makeAPISwarm(ctx, true, 3)
nds, apis, err := makeAPISwarm(ctx, true, 5)
if err != nil {
t.Fatal(err)
}
Expand All @@ -27,8 +27,8 @@ func TestDhtFindPeer(t *testing.T) {

addr := <-out

if addr.String() != "/ip4/127.0.0.1/tcp/4001" {
t.Errorf("got unexpected address from FindPeer: %s", addr.String())
if addr == nil || addr.String() != "/ip4/127.0.0.1/tcp/4001" {
t.Errorf("got unexpected address from FindPeer: %s", addr)
}

out, err = apis[1].Dht().FindPeer(ctx, peer.ID(nds[2].Identity))
Expand All @@ -38,14 +38,14 @@ func TestDhtFindPeer(t *testing.T) {

addr = <-out

if addr.String() != "/ip4/127.0.2.1/tcp/4001" {
t.Errorf("got unexpected address from FindPeer: %s", addr.String())
if addr == nil || addr.String() != "/ip4/127.0.2.1/tcp/4001" {
t.Errorf("got unexpected address from FindPeer: %s", addr)
}
}

func TestDhtFindProviders(t *testing.T) {
ctx := context.Background()
nds, apis, err := makeAPISwarm(ctx, true, 3)
nds, apis, err := makeAPISwarm(ctx, true, 5)
if err != nil {
t.Fatal(err)
}
Expand All @@ -69,7 +69,7 @@ func TestDhtFindProviders(t *testing.T) {

func TestDhtProvide(t *testing.T) {
ctx := context.Background()
nds, apis, err := makeAPISwarm(ctx, true, 3)
nds, apis, err := makeAPISwarm(ctx, true, 5)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 77f6604

Please sign in to comment.