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
interface-go-dms3-core
Commits
89157f98
Commit
89157f98
authored
Jan 02, 2019
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi: don't panic as much in tests
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
aa64f771
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
tests/api.go
tests/api.go
+1
-1
tests/block.go
tests/block.go
+6
-6
tests/dag.go
tests/dag.go
+6
-6
No files found.
tests/api.go
View file @
89157f98
...
...
@@ -71,7 +71,7 @@ func TestApi(p Provider) func(t *testing.T) {
select
{
case
<-
zeroRunning
:
case
<-
time
.
After
(
time
.
Second
)
:
t
.
Errorf
(
"%d
node
(s) not closed"
,
running
)
t
.
Errorf
(
"%d
test swarms
(s) not closed"
,
running
)
}
})
}
...
...
tests/block.go
View file @
89157f98
...
...
@@ -26,12 +26,12 @@ func (tp *provider) TestBlockPut(t *testing.T) {
defer
cancel
()
api
,
err
:=
tp
.
makeAPI
(
ctx
)
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
res
,
err
:=
api
.
Block
()
.
Put
(
ctx
,
strings
.
NewReader
(
`Hello`
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
if
res
.
Path
()
.
Cid
()
.
String
()
!=
"QmPyo15ynbVrSTVdJL9th7JysHaAbXt9dM9tXk1bMHbRtk"
{
...
...
@@ -49,7 +49,7 @@ func (tp *provider) TestBlockPutFormat(t *testing.T) {
res
,
err
:=
api
.
Block
()
.
Put
(
ctx
,
strings
.
NewReader
(
`Hello`
),
opt
.
Block
.
Format
(
"cbor"
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
if
res
.
Path
()
.
Cid
()
.
String
()
!=
"zdpuAn4amuLWo8Widi5v6VQpuo2dnpnwbVE3oB6qqs7mDSeoa"
{
...
...
@@ -85,7 +85,7 @@ func (tp *provider) TestBlockGet(t *testing.T) {
res
,
err
:=
api
.
Block
()
.
Put
(
ctx
,
strings
.
NewReader
(
`Hello`
),
opt
.
Block
.
Hash
(
mh
.
KECCAK_512
,
-
1
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
r
,
err
:=
api
.
Block
()
.
Get
(
ctx
,
res
.
Path
())
...
...
@@ -126,7 +126,7 @@ func (tp *provider) TestBlockRm(t *testing.T) {
res
,
err
:=
api
.
Block
()
.
Put
(
ctx
,
strings
.
NewReader
(
`Hello`
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
r
,
err
:=
api
.
Block
()
.
Get
(
ctx
,
res
.
Path
())
...
...
@@ -180,7 +180,7 @@ func (tp *provider) TestBlockStat(t *testing.T) {
res
,
err
:=
api
.
Block
()
.
Put
(
ctx
,
strings
.
NewReader
(
`Hello`
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
stat
,
err
:=
api
.
Block
()
.
Stat
(
ctx
,
res
.
Path
())
...
...
tests/dag.go
View file @
89157f98
...
...
@@ -40,7 +40,7 @@ func (tp *provider) TestPut(t *testing.T) {
res
,
err
:=
api
.
Dag
()
.
Put
(
ctx
,
strings
.
NewReader
(
`"Hello"`
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
if
res
.
Cid
()
.
String
()
!=
"zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv"
{
...
...
@@ -58,7 +58,7 @@ func (tp *provider) TestPutWithHash(t *testing.T) {
res
,
err
:=
api
.
Dag
()
.
Put
(
ctx
,
strings
.
NewReader
(
`"Hello"`
),
opt
.
Dag
.
Hash
(
mh
.
ID
,
-
1
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
if
res
.
Cid
()
.
String
()
!=
"z5hRLNd2sv4z1c"
{
...
...
@@ -76,12 +76,12 @@ func (tp *provider) TestDagPath(t *testing.T) {
sub
,
err
:=
api
.
Dag
()
.
Put
(
ctx
,
strings
.
NewReader
(
`"foo"`
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
res
,
err
:=
api
.
Dag
()
.
Put
(
ctx
,
strings
.
NewReader
(
`{"lnk": {"/": "`
+
sub
.
Cid
()
.
String
()
+
`"}}`
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
p
,
err
:=
coreiface
.
ParsePath
(
path
.
Join
(
res
.
Cid
()
.
String
(),
"lnk"
))
...
...
@@ -109,7 +109,7 @@ func (tp *provider) TestTree(t *testing.T) {
c
,
err
:=
api
.
Dag
()
.
Put
(
ctx
,
strings
.
NewReader
(
`{"a": 123, "b": "foo", "c": {"d": 321, "e": 111}}`
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
res
,
err
:=
api
.
Dag
()
.
Get
(
ctx
,
c
)
...
...
@@ -141,7 +141,7 @@ func (tp *provider) TestBatch(t *testing.T) {
c
,
err
:=
batch
.
Put
(
ctx
,
strings
.
NewReader
(
`"Hello"`
))
if
err
!=
nil
{
t
.
Error
(
err
)
t
.
Fatal
(
err
)
}
if
c
.
Cid
()
.
String
()
!=
"zdpuAqckYF3ToF3gcJNxPZXmnmGuXd3gxHCXhq81HGxBejEvv"
{
...
...
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