Commit 8c589a00 authored by Jeromy's avatar Jeromy

blockservice.New doesnt need to return an error

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent ca37d6f1
......@@ -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))
}
......
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)
}
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment