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
8c589a00
Commit
8c589a00
authored
Aug 14, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
blockservice.New doesnt need to return an error
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
ca37d6f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
14 deletions
+6
-14
merkledag_test.go
merkledag_test.go
+2
-5
test/utils.go
test/utils.go
+2
-7
utils/utils_test.go
utils/utils_test.go
+2
-2
No files found.
merkledag_test.go
View file @
8c589a00
...
...
@@ -33,10 +33,7 @@ type dagservAndPinner struct {
func
getDagservAndPinner
(
t
*
testing
.
T
)
dagservAndPinner
{
db
:=
dssync
.
MutexWrap
(
ds
.
NewMapDatastore
())
bs
:=
bstore
.
NewBlockstore
(
db
)
blockserv
,
err
:=
bserv
.
New
(
bs
,
offline
.
Exchange
(
bs
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
blockserv
:=
bserv
.
New
(
bs
,
offline
.
Exchange
(
bs
))
dserv
:=
NewDAGService
(
blockserv
)
mpin
:=
pin
.
NewPinner
(
db
,
dserv
)
.
GetManual
()
return
dagservAndPinner
{
...
...
@@ -159,7 +156,7 @@ func TestBatchFetchDupBlock(t *testing.T) {
func
runBatchFetchTest
(
t
*
testing
.
T
,
read
io
.
Reader
)
{
var
dagservs
[]
DAGService
for
_
,
bsi
:=
range
bstest
.
Mocks
(
t
,
5
)
{
for
_
,
bsi
:=
range
bstest
.
Mocks
(
5
)
{
dagservs
=
append
(
dagservs
,
NewDAGService
(
bsi
))
}
...
...
test/utils.go
View file @
8c589a00
package
mdutils
import
(
"testing"
ds
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dssync
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
"github.com/ipfs/go-ipfs/blocks/blockstore"
...
...
@@ -11,11 +9,8 @@ import (
dag
"github.com/ipfs/go-ipfs/merkledag"
)
func
Mock
(
t
testing
.
TB
)
dag
.
DAGService
{
func
Mock
()
dag
.
DAGService
{
bstore
:=
blockstore
.
NewBlockstore
(
dssync
.
MutexWrap
(
ds
.
NewMapDatastore
()))
bserv
,
err
:=
bsrv
.
New
(
bstore
,
offline
.
Exchange
(
bstore
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
bserv
:=
bsrv
.
New
(
bstore
,
offline
.
Exchange
(
bstore
))
return
dag
.
NewDAGService
(
bserv
)
}
utils/utils_test.go
View file @
8c589a00
...
...
@@ -12,7 +12,7 @@ import (
)
func
TestAddLink
(
t
*
testing
.
T
)
{
ds
:=
mdtest
.
Mock
(
t
)
ds
:=
mdtest
.
Mock
()
fishnode
:=
&
dag
.
Node
{
Data
:
[]
byte
(
"fishcakes!"
),
}
...
...
@@ -66,7 +66,7 @@ func assertNodeAtPath(t *testing.T, ds dag.DAGService, root *dag.Node, path stri
}
func
TestInsertNode
(
t
*
testing
.
T
)
{
ds
:=
mdtest
.
Mock
(
t
)
ds
:=
mdtest
.
Mock
()
root
:=
new
(
dag
.
Node
)
e
:=
NewDagEditor
(
ds
,
root
)
...
...
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