Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-namesys
Commits
a360c661
Commit
a360c661
authored
Apr 16, 2021
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests
parent
ea4eec1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
namesys_test.go
namesys_test.go
+10
-3
republisher/repub_test.go
republisher/repub_test.go
+8
-4
No files found.
namesys_test.go
View file @
a360c661
...
@@ -17,7 +17,6 @@ import (
...
@@ -17,7 +17,6 @@ import (
peer
"github.com/libp2p/go-libp2p-core/peer"
peer
"github.com/libp2p/go-libp2p-core/peer"
pstoremem
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
pstoremem
"github.com/libp2p/go-libp2p-peerstore/pstoremem"
record
"github.com/libp2p/go-libp2p-record"
record
"github.com/libp2p/go-libp2p-record"
madns
"github.com/multiformats/go-multiaddr-dns"
)
)
type
mockResolver
struct
{
type
mockResolver
struct
{
...
@@ -110,7 +109,11 @@ func TestPublishWithCache0(t *testing.T) {
...
@@ -110,7 +109,11 @@ func TestPublishWithCache0(t *testing.T) {
"pk"
:
record
.
PublicKeyValidator
{},
"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.
// CID is arbitrary.
p
,
err
:=
path
.
ParsePath
(
"QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
)
p
,
err
:=
path
.
ParsePath
(
"QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -143,7 +146,11 @@ func TestPublishWithTTL(t *testing.T) {
...
@@ -143,7 +146,11 @@ func TestPublishWithTTL(t *testing.T) {
"pk"
:
record
.
PublicKeyValidator
{},
"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.
// CID is arbitrary.
p
,
err
:=
path
.
ParsePath
(
"QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
)
p
,
err
:=
path
.
ParsePath
(
"QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
republisher/repub_test.go
View file @
a360c661
...
@@ -22,8 +22,6 @@ import (
...
@@ -22,8 +22,6 @@ import (
ipns_pb
"github.com/ipfs/go-ipns/pb"
ipns_pb
"github.com/ipfs/go-ipns/pb"
path
"github.com/ipfs/go-path"
path
"github.com/ipfs/go-path"
madns
"github.com/multiformats/go-multiaddr-dns"
keystore
"github.com/ipfs/go-ipfs-keystore"
keystore
"github.com/ipfs/go-ipfs-keystore"
namesys
"github.com/ipfs/go-namesys"
namesys
"github.com/ipfs/go-namesys"
.
"github.com/ipfs/go-namesys/republisher"
.
"github.com/ipfs/go-namesys/republisher"
...
@@ -76,7 +74,10 @@ func TestRepublish(t *testing.T) {
...
@@ -76,7 +74,10 @@ func TestRepublish(t *testing.T) {
var
nodes
[]
*
mockNode
var
nodes
[]
*
mockNode
for
i
:=
0
;
i
<
10
;
i
++
{
for
i
:=
0
;
i
<
10
;
i
++
{
n
:=
getMockNode
(
t
,
ctx
)
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
)
nsystems
=
append
(
nsystems
,
ns
)
nodes
=
append
(
nodes
,
n
)
nodes
=
append
(
nodes
,
n
)
...
@@ -155,7 +156,10 @@ func TestLongEOLRepublish(t *testing.T) {
...
@@ -155,7 +156,10 @@ func TestLongEOLRepublish(t *testing.T) {
var
nodes
[]
*
mockNode
var
nodes
[]
*
mockNode
for
i
:=
0
;
i
<
10
;
i
++
{
for
i
:=
0
;
i
<
10
;
i
++
{
n
:=
getMockNode
(
t
,
ctx
)
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
)
nsystems
=
append
(
nsystems
,
ns
)
nodes
=
append
(
nodes
,
n
)
nodes
=
append
(
nodes
,
n
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment