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-dms3
Commits
4f1a861b
Unverified
Commit
4f1a861b
authored
Aug 18, 2016
by
Jakub Sztandera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: use mdag/test.Mock() instead
License: MIT Signed-off-by:
Jakub Sztandera
<
kubuxu@protonmail.ch
>
parent
02f6bd63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
14 deletions
+2
-14
unixfs/io/dagserv_test.go
unixfs/io/dagserv_test.go
+2
-14
No files found.
unixfs/io/dagserv_test.go
View file @
4f1a861b
...
...
@@ -7,27 +7,15 @@ import (
"io/ioutil"
"testing"
"github.com/ipfs/go-ipfs/blocks/blockstore"
bs
"github.com/ipfs/go-ipfs/blockservice"
"github.com/ipfs/go-ipfs/exchange/offline"
imp
"github.com/ipfs/go-ipfs/importer"
"github.com/ipfs/go-ipfs/importer/chunk"
mdag
"github.com/ipfs/go-ipfs/merkledag"
mdagmock
"github.com/ipfs/go-ipfs/merkledag/test"
ds
"gx/ipfs/QmTxLSvdhwg68WJimdS6icLPhZi28aTp6b7uihC2Yb47Xk/go-datastore"
"gx/ipfs/QmTxLSvdhwg68WJimdS6icLPhZi28aTp6b7uihC2Yb47Xk/go-datastore/sync"
u
"gx/ipfs/QmZNVWh8LLjAavuQ2JXuFmuYH3C11xo988vSgp7UQrTRj1/go-ipfs-util"
context
"gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
)
func
getMockDagServ
(
t
testing
.
TB
)
mdag
.
DAGService
{
dstore
:=
ds
.
NewMapDatastore
()
tsds
:=
sync
.
MutexWrap
(
dstore
)
bstore
:=
blockstore
.
NewBlockstore
(
tsds
)
bserv
:=
bs
.
New
(
bstore
,
offline
.
Exchange
(
bstore
))
return
mdag
.
NewDAGService
(
bserv
)
}
func
sizeSplitterGen
(
size
int64
)
chunk
.
SplitterGen
{
return
func
(
r
io
.
Reader
)
chunk
.
Splitter
{
return
chunk
.
NewSizeSplitter
(
r
,
size
)
...
...
@@ -68,7 +56,7 @@ func arrComp(a, b []byte) error {
}
func
TestBasicRead
(
t
*
testing
.
T
)
{
dserv
:=
getMockDagServ
(
t
)
dserv
:=
mdagmock
.
Mock
(
)
inbuf
,
node
:=
getRandomNode
(
t
,
dserv
,
1024
)
ctx
,
closer
:=
context
.
WithCancel
(
context
.
Background
())
defer
closer
()
...
...
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