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

Commit 7a6125f

Browse files
committed
fix tests
1 parent 8bd5e9d commit 7a6125f

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

namesys_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
peer "github.com/libp2p/go-libp2p-core/peer"
1818
pstoremem "github.com/libp2p/go-libp2p-peerstore/pstoremem"
1919
record "github.com/libp2p/go-libp2p-record"
20-
madns "github.com/multiformats/go-multiaddr-dns"
2120
)
2221

2322
type mockResolver struct {
@@ -110,7 +109,11 @@ func TestPublishWithCache0(t *testing.T) {
110109
"pk": record.PublicKeyValidator{},
111110
})
112111

113-
nsys := NewNameSystem(routing, dst, madns.DefaultResolver, 0)
112+
nsys, err := NewNameSystem(routing, WithDatastore(dst))
113+
if err != nil {
114+
t.Fatal(err)
115+
}
116+
114117
// CID is arbitrary.
115118
p, err := path.ParsePath("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn")
116119
if err != nil {
@@ -143,7 +146,11 @@ func TestPublishWithTTL(t *testing.T) {
143146
"pk": record.PublicKeyValidator{},
144147
})
145148

146-
nsys := NewNameSystem(routing, dst, madns.DefaultResolver, 128)
149+
nsys, err := NewNameSystem(routing, WithDatastore(dst), WithCache(128))
150+
if err != nil {
151+
t.Fatal(err)
152+
}
153+
147154
// CID is arbitrary.
148155
p, err := path.ParsePath("QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn")
149156
if err != nil {

republisher/repub_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import (
2222
ipns_pb "github.com/ipfs/go-ipns/pb"
2323
path "github.com/ipfs/go-path"
2424

25-
madns "github.com/multiformats/go-multiaddr-dns"
26-
2725
keystore "github.com/ipfs/go-ipfs-keystore"
2826
namesys "github.com/ipfs/go-namesys"
2927
. "github.com/ipfs/go-namesys/republisher"
@@ -76,7 +74,10 @@ func TestRepublish(t *testing.T) {
7674
var nodes []*mockNode
7775
for i := 0; i < 10; i++ {
7876
n := getMockNode(t, ctx)
79-
ns := namesys.NewNameSystem(n.dht, n.store, madns.DefaultResolver, 0)
77+
ns, err := namesys.NewNameSystem(n.dht, namesys.WithDatastore(n.store))
78+
if err != nil {
79+
t.Fatal(err)
80+
}
8081

8182
nsystems = append(nsystems, ns)
8283
nodes = append(nodes, n)
@@ -155,7 +156,10 @@ func TestLongEOLRepublish(t *testing.T) {
155156
var nodes []*mockNode
156157
for i := 0; i < 10; i++ {
157158
n := getMockNode(t, ctx)
158-
ns := namesys.NewNameSystem(n.dht, n.store, madns.DefaultResolver, 0)
159+
ns, err := namesys.NewNameSystem(n.dht, namesys.WithDatastore(n.store))
160+
if err != nil {
161+
t.Fatal(err)
162+
}
159163

160164
nsystems = append(nsystems, ns)
161165
nodes = append(nodes, n)

0 commit comments

Comments
 (0)