@cryptotaxi247 / kubo / commits / 4f1a861be

test: use mdag/test.Mock() instead

License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>

Jakub Sztandera committed Aug 18, 2016 at 21:33 UTC 4f1a861bed4beb015be11d3a93bb814b3b31e990
1 file changed +2 -14
unixfs/io/dagserv_test.go
+2 -14
@@ -7,27 +7,15 @@ import (
7 "io/ioutil"
8 "testing"
9
10 - "github.com/ipfs/go-ipfs/blocks/blockstore"
11 - bs "github.com/ipfs/go-ipfs/blockservice"
12 - "github.com/ipfs/go-ipfs/exchange/offline"
10 imp "github.com/ipfs/go-ipfs/importer"
11 "github.com/ipfs/go-ipfs/importer/chunk"
12 mdag "github.com/ipfs/go-ipfs/merkledag"
13 + mdagmock "github.com/ipfs/go-ipfs/merkledag/test"
14
17 - ds "gx/ipfs/QmTxLSvdhwg68WJimdS6icLPhZi28aTp6b7uihC2Yb47Xk/go-datastore"
18 - "gx/ipfs/QmTxLSvdhwg68WJimdS6icLPhZi28aTp6b7uihC2Yb47Xk/go-datastore/sync"
15 u "gx/ipfs/QmZNVWh8LLjAavuQ2JXuFmuYH3C11xo988vSgp7UQrTRj1/go-ipfs-util"
16 context "gx/ipfs/QmZy2y8t9zQH2a1b8q2ZSLKp17ATuJoCNxxyMFG5qFExpt/go-net/context"
17 )
18
23 -func getMockDagServ(t testing.TB) mdag.DAGService {
24 - dstore := ds.NewMapDatastore()
25 - tsds := sync.MutexWrap(dstore)
26 - bstore := blockstore.NewBlockstore(tsds)
27 - bserv := bs.New(bstore, offline.Exchange(bstore))
28 - return mdag.NewDAGService(bserv)
29 -}
30 -
19 func sizeSplitterGen(size int64) chunk.SplitterGen {
20 return func(r io.Reader) chunk.Splitter {
21 return chunk.NewSizeSplitter(r, size)
@@ -68,7 +56,7 @@ func arrComp(a, b []byte) error {
56 }
57
58 func TestBasicRead(t *testing.T) {
71 - dserv := getMockDagServ(t)
59 + dserv := mdagmock.Mock()
60 inbuf, node := getRandomNode(t, dserv, 1024)
61 ctx, closer := context.WithCancel(context.Background())
62 defer closer()