Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Apr 15, 2021
1 parent 8bd5e9d commit 7a6125f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 10 additions & 3 deletions namesys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
peer "github.com/libp2p/go-libp2p-core/peer"
pstoremem "github.com/libp2p/go-libp2p-peerstore/pstoremem"
record "github.com/libp2p/go-libp2p-record"
madns "github.com/multiformats/go-multiaddr-dns"
)

type mockResolver struct {
Expand Down Expand Up @@ -110,7 +109,11 @@ func TestPublishWithCache0(t *testing.T) {
"pk": record.PublicKeyValidator{},
})

nsys := NewNameSystem(routing, dst, madns.DefaultResolver, 0)
nsys, err := NewNameSystem(routing, WithDatastore(dst))
if err != nil {
t.Fatal(err)
}

// CID is arbitrary.
p, err := path.ParsePath("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn")
if err != nil {
Expand Down Expand Up @@ -143,7 +146,11 @@ func TestPublishWithTTL(t *testing.T) {
"pk": record.PublicKeyValidator{},
})

nsys := NewNameSystem(routing, dst, madns.DefaultResolver, 128)
nsys, err := NewNameSystem(routing, WithDatastore(dst), WithCache(128))
if err != nil {
t.Fatal(err)
}

// CID is arbitrary.
p, err := path.ParsePath("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn")
if err != nil {
Expand Down
12 changes: 8 additions & 4 deletions republisher/repub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
ipns_pb "github.com/ipfs/go-ipns/pb"
path "github.com/ipfs/go-path"

madns "github.com/multiformats/go-multiaddr-dns"

keystore "github.com/ipfs/go-ipfs-keystore"
namesys "github.com/ipfs/go-namesys"
. "github.com/ipfs/go-namesys/republisher"
Expand Down Expand Up @@ -76,7 +74,10 @@ func TestRepublish(t *testing.T) {
var nodes []*mockNode
for i := 0; i < 10; i++ {
n := getMockNode(t, ctx)
ns := namesys.NewNameSystem(n.dht, n.store, madns.DefaultResolver, 0)
ns, err := namesys.NewNameSystem(n.dht, namesys.WithDatastore(n.store))
if err != nil {
t.Fatal(err)
}

nsystems = append(nsystems, ns)
nodes = append(nodes, n)
Expand Down Expand Up @@ -155,7 +156,10 @@ func TestLongEOLRepublish(t *testing.T) {
var nodes []*mockNode
for i := 0; i < 10; i++ {
n := getMockNode(t, ctx)
ns := namesys.NewNameSystem(n.dht, n.store, madns.DefaultResolver, 0)
ns, err := namesys.NewNameSystem(n.dht, namesys.WithDatastore(n.store))
if err != nil {
t.Fatal(err)
}

nsystems = append(nsystems, ns)
nodes = append(nodes, n)
Expand Down

0 comments on commit 7a6125f

Please sign in to comment.