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-dms3
Commits
f0d823c2
Commit
f0d823c2
authored
Oct 30, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests (circular import)
parent
71ac1175
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
core/core.go
core/core.go
+2
-2
unixfs/io/dagwriter_test.go
unixfs/io/dagwriter_test.go
+8
-7
No files found.
core/core.go
View file @
f0d823c2
...
...
@@ -161,8 +161,8 @@ func NewIpfsNode(cfg *config.Config, online bool) (n *IpfsNode, err error) {
if
err
!=
nil
{
n
.
Pinning
=
pin
.
NewPinner
(
n
.
Datastore
,
n
.
DAG
)
}
n
.
Resolver
=
&
path
.
Resolver
{
DAG
:
n
.
DAG
}
n
.
Resolver
=
&
path
.
Resolver
{
DAG
:
n
.
DAG
}
success
=
true
return
n
,
nil
}
...
...
unixfs/io/dagwriter_test.go
View file @
f0d823c2
package
io
package
io
_test
import
(
"testing"
...
...
@@ -7,9 +7,10 @@ import (
ds
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
bs
"github.com/jbenet/go-ipfs/blockservice"
"github.com/jbenet/go-ipfs/importer"
importer
"github.com/jbenet/go-ipfs/importer"
chunk
"github.com/jbenet/go-ipfs/importer/chunk"
mdag
"github.com/jbenet/go-ipfs/merkledag"
dagio
"github.com/jbenet/go-ipfs/unixfs/io"
)
type
datasource
struct
{
...
...
@@ -55,7 +56,7 @@ func TestDagWriter(t *testing.T) {
t
.
Fatal
(
err
)
}
dag
:=
mdag
.
NewDAGService
(
bserv
)
dw
:=
NewDagWriter
(
dag
,
&
chunk
.
SizeSplitter
{
Size
:
4096
})
dw
:=
dagio
.
NewDagWriter
(
dag
,
&
chunk
.
SizeSplitter
{
Size
:
4096
})
nbytes
:=
int64
(
1024
*
1024
*
2
)
n
,
err
:=
io
.
CopyN
(
dw
,
&
datasource
{},
nbytes
)
...
...
@@ -70,7 +71,7 @@ func TestDagWriter(t *testing.T) {
dw
.
Close
()
node
:=
dw
.
GetNode
()
read
,
err
:=
NewDagReader
(
node
,
dag
)
read
,
err
:=
dagio
.
NewDagReader
(
node
,
dag
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -89,7 +90,7 @@ func TestMassiveWrite(t *testing.T) {
t
.
Fatal
(
err
)
}
dag
:=
mdag
.
NewDAGService
(
bserv
)
dw
:=
NewDagWriter
(
dag
,
&
chunk
.
SizeSplitter
{
Size
:
4096
})
dw
:=
dagio
.
NewDagWriter
(
dag
,
&
chunk
.
SizeSplitter
{
Size
:
4096
})
nbytes
:=
int64
(
1024
*
1024
*
1024
*
16
)
n
,
err
:=
io
.
CopyN
(
dw
,
&
datasource
{},
nbytes
)
...
...
@@ -114,7 +115,7 @@ func BenchmarkDagWriter(b *testing.B) {
nbytes
:=
int64
(
100000
)
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
b
.
SetBytes
(
nbytes
)
dw
:=
NewDagWriter
(
dag
,
&
chunk
.
SizeSplitter
{
Size
:
4096
})
dw
:=
dagio
.
NewDagWriter
(
dag
,
&
chunk
.
SizeSplitter
{
Size
:
4096
})
n
,
err
:=
io
.
CopyN
(
dw
,
&
datasource
{},
nbytes
)
if
err
!=
nil
{
b
.
Fatal
(
err
)
...
...
@@ -138,7 +139,7 @@ func TestAgainstImporter(t *testing.T) {
nbytes
:=
int64
(
1024
*
1024
*
2
)
// DagWriter
dw
:=
NewDagWriter
(
dag
,
&
chunk
.
SizeSplitter
{
4096
})
dw
:=
dagio
.
NewDagWriter
(
dag
,
&
chunk
.
SizeSplitter
{
4096
})
n
,
err
:=
io
.
CopyN
(
dw
,
&
datasource
{},
nbytes
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
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