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 { ...@@ -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))
} }
......
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)
} }
...@@ -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)
......
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