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 {
...
@@ -33,10 +33,7 @@ type dagservAndPinner struct {
func
getDagservAndPinner
(
t
*
testing
.
T
)
dagservAndPinner
{
func
getDagservAndPinner
(
t
*
testing
.
T
)
dagservAndPinner
{
db
:=
dssync
.
MutexWrap
(
ds
.
NewMapDatastore
())
db
:=
dssync
.
MutexWrap
(
ds
.
NewMapDatastore
())
bs
:=
bstore
.
NewBlockstore
(
db
)
bs
:=
bstore
.
NewBlockstore
(
db
)
blockserv
,
err
:=
bserv
.
New
(
bs
,
offline
.
Exchange
(
bs
))
blockserv
:=
bserv
.
New
(
bs
,
offline
.
Exchange
(
bs
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
dserv
:=
NewDAGService
(
blockserv
)
dserv
:=
NewDAGService
(
blockserv
)
mpin
:=
pin
.
NewPinner
(
db
,
dserv
)
.
GetManual
()
mpin
:=
pin
.
NewPinner
(
db
,
dserv
)
.
GetManual
()
return
dagservAndPinner
{
return
dagservAndPinner
{
...
@@ -159,7 +156,7 @@ func TestBatchFetchDupBlock(t *testing.T) {
...
@@ -159,7 +156,7 @@ func TestBatchFetchDupBlock(t *testing.T) {
func
runBatchFetchTest
(
t
*
testing
.
T
,
read
io
.
Reader
)
{
func
runBatchFetchTest
(
t
*
testing
.
T
,
read
io
.
Reader
)
{
var
dagservs
[]
DAGService
var
dagservs
[]
DAGService
for
_
,
bsi
:=
range
bstest
.
Mocks
(
t
,
5
)
{
for
_
,
bsi
:=
range
bstest
.
Mocks
(
5
)
{
dagservs
=
append
(
dagservs
,
NewDAGService
(
bsi
))
dagservs
=
append
(
dagservs
,
NewDAGService
(
bsi
))
}
}
...
...
test/utils.go
View file @
8c589a00
package
mdutils
package
mdutils
import
(
import
(
"testing"
ds
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
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"
dssync
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
"github.com/ipfs/go-ipfs/blocks/blockstore"
"github.com/ipfs/go-ipfs/blocks/blockstore"
...
@@ -11,11 +9,8 @@ import (
...
@@ -11,11 +9,8 @@ import (
dag
"github.com/ipfs/go-ipfs/merkledag"
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
()))
bstore
:=
blockstore
.
NewBlockstore
(
dssync
.
MutexWrap
(
ds
.
NewMapDatastore
()))
bserv
,
err
:=
bsrv
.
New
(
bstore
,
offline
.
Exchange
(
bstore
))
bserv
:=
bsrv
.
New
(
bstore
,
offline
.
Exchange
(
bstore
))
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
return
dag
.
NewDAGService
(
bserv
)
return
dag
.
NewDAGService
(
bserv
)
}
}
utils/utils_test.go
View file @
8c589a00
...
@@ -12,7 +12,7 @@ import (
...
@@ -12,7 +12,7 @@ import (
)
)
func
TestAddLink
(
t
*
testing
.
T
)
{
func
TestAddLink
(
t
*
testing
.
T
)
{
ds
:=
mdtest
.
Mock
(
t
)
ds
:=
mdtest
.
Mock
()
fishnode
:=
&
dag
.
Node
{
fishnode
:=
&
dag
.
Node
{
Data
:
[]
byte
(
"fishcakes!"
),
Data
:
[]
byte
(
"fishcakes!"
),
}
}
...
@@ -66,7 +66,7 @@ func assertNodeAtPath(t *testing.T, ds dag.DAGService, root *dag.Node, path stri
...
@@ -66,7 +66,7 @@ func assertNodeAtPath(t *testing.T, ds dag.DAGService, root *dag.Node, path stri
}
}
func
TestInsertNode
(
t
*
testing
.
T
)
{
func
TestInsertNode
(
t
*
testing
.
T
)
{
ds
:=
mdtest
.
Mock
(
t
)
ds
:=
mdtest
.
Mock
()
root
:=
new
(
dag
.
Node
)
root
:=
new
(
dag
.
Node
)
e
:=
NewDagEditor
(
ds
,
root
)
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