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-merkledag
Commits
07070300
Commit
07070300
authored
Aug 19, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pin: use separate dagservice for storing pinsets
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
parent
6d1508da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
23 deletions
+2
-23
merkledag_test.go
merkledag_test.go
+2
-23
No files found.
merkledag_test.go
View file @
07070300
...
...
@@ -10,7 +10,6 @@ import (
"sync"
"testing"
bstore
"github.com/ipfs/go-ipfs/blocks/blockstore"
key
"github.com/ipfs/go-ipfs/blocks/key"
bserv
"github.com/ipfs/go-ipfs/blockservice"
bstest
"github.com/ipfs/go-ipfs/blockservice/test"
...
...
@@ -19,31 +18,11 @@ import (
chunk
"github.com/ipfs/go-ipfs/importer/chunk"
.
"github.com/ipfs/go-ipfs/merkledag"
dstest
"github.com/ipfs/go-ipfs/merkledag/test"
"github.com/ipfs/go-ipfs/pin"
uio
"github.com/ipfs/go-ipfs/unixfs/io"
ds
"gx/ipfs/QmTxLSvdhwg68WJimdS6icLPhZi28aTp6b7uihC2Yb47Xk/go-datastore"
dssync
"gx/ipfs/QmTxLSvdhwg68WJimdS6icLPhZi28aTp6b7uihC2Yb47Xk/go-datastore/sync"
u
"gx/ipfs/QmZNVWh8LLjAavuQ2JXuFmuYH3C11xo988vSgp7UQrTRj1/go-ipfs-util"
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
)
type
dagservAndPinner
struct
{
ds
DAGService
mp
pin
.
Pinner
}
func
getDagservAndPinner
(
t
*
testing
.
T
)
dagservAndPinner
{
db
:=
dssync
.
MutexWrap
(
ds
.
NewMapDatastore
())
bs
:=
bstore
.
NewBlockstore
(
db
)
blockserv
:=
bserv
.
New
(
bs
,
offline
.
Exchange
(
bs
))
dserv
:=
NewDAGService
(
blockserv
)
mpin
:=
pin
.
NewPinner
(
db
,
dserv
)
return
dagservAndPinner
{
ds
:
dserv
,
mp
:
mpin
,
}
}
func
TestNode
(
t
*
testing
.
T
)
{
n1
:=
NodeWithData
([]
byte
(
"beep"
))
...
...
@@ -254,7 +233,7 @@ func TestEmptyKey(t *testing.T) {
}
func
TestCantGet
(
t
*
testing
.
T
)
{
ds
p
:=
getDagservAndPinner
(
t
)
ds
:=
dstest
.
Mock
(
)
a
:=
NodeWithData
([]
byte
(
"A"
))
k
,
err
:=
a
.
Key
()
...
...
@@ -262,7 +241,7 @@ func TestCantGet(t *testing.T) {
t
.
Fatal
(
err
)
}
_
,
err
=
dsp
.
ds
.
Get
(
context
.
Background
(),
k
)
_
,
err
=
ds
.
Get
(
context
.
Background
(),
k
)
if
!
strings
.
Contains
(
err
.
Error
(),
"not found"
)
{
t
.
Fatal
(
"expected err not found, got: "
,
err
)
}
...
...
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