Commit 89157f98 authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi: don't panic as much in tests

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent aa64f771
......@@ -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)
}
})
}
......
......@@ -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())
......
......@@ -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" {
......
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