|
|
|
@ -3,9 +3,11 @@ package discovery |
|
|
|
|
// TODO: test this module
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"context" |
|
|
|
|
"testing" |
|
|
|
|
|
|
|
|
|
"github.com/libp2p/go-libp2p" |
|
|
|
|
dht "github.com/libp2p/go-libp2p-kad-dht" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func TestNewDHTDiscovery(t *testing.T) { |
|
|
|
@ -13,7 +15,13 @@ func TestNewDHTDiscovery(t *testing.T) { |
|
|
|
|
if err != nil { |
|
|
|
|
t.Fatal(err) |
|
|
|
|
} |
|
|
|
|
_, err = NewDHTDiscovery(host, DHTConfig{}) |
|
|
|
|
ctx, cancel := context.WithCancel(context.Background()) |
|
|
|
|
var idht *dht.IpfsDHT |
|
|
|
|
idht, err = dht.New(ctx, host) |
|
|
|
|
if err != nil { |
|
|
|
|
t.Fatal(err) |
|
|
|
|
} |
|
|
|
|
_, err = NewDHTDiscovery(ctx, cancel, host, idht, DHTConfig{}) |
|
|
|
|
if err != nil { |
|
|
|
|
t.Fatal(err) |
|
|
|
|
} |
|
|
|
|