Fix tests

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
Jakub Sztandera 2019-07-18 17:52:48 +02:00
parent 6496805cc3
commit 5ee7ba8420
4 changed files with 4 additions and 10 deletions

View File

@ -2,11 +2,11 @@ package test
import (
"context"
"strings"
"testing"
"github.com/filecoin-project/go-lotus/api"
"github.com/filecoin-project/go-lotus/build"
"github.com/stretchr/testify/assert"
)
// APIBuilder is a function which is invoked in test suite to provide
@ -49,9 +49,7 @@ func (ts *testSuite) testID(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if !strings.HasPrefix(id.Pretty(), "Qm") {
t.Error("expected identity to be Qm..")
}
assert.Regexp(t, "^12", id.Pretty())
}
func (ts *testSuite) testConnectTwo(t *testing.T) {

1
go.mod
View File

@ -66,7 +66,6 @@ require (
go4.org v0.0.0-20190313082347-94abd6928b1d // indirect
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522
google.golang.org/appengine v1.4.0 // indirect
gopkg.in/urfave/cli.v2 v2.0.0-20180128182452-d3ae77c26ac8
launchpad.net/gocheck v0.0.0-20140225173054-000000000087 // indirect
)

View File

@ -116,11 +116,6 @@ var defConf = config.Default()
func defaults() []Option {
return []Option{
Override(new(helpers.MetricsCtx), context.Background),
randomIdentity(),
Override(new(datastore.Batching), testing.MapDatastore),
Override(new(blockstore.Blockstore), testing.MapBlockstore), // NOT on top of ds above
Override(new(record.Validator), modules.RecordValidator),
// Filecoin modules

View File

@ -12,6 +12,7 @@ import (
"github.com/filecoin-project/go-lotus/api/test"
"github.com/filecoin-project/go-lotus/lib/jsonrpc"
"github.com/filecoin-project/go-lotus/node/repo"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
)
@ -25,6 +26,7 @@ func builder(t *testing.T, n int) []api.API {
var err error
out[i], err = node.New(ctx,
node.Online(),
node.Repo(repo.NewMemory(nil)),
MockHost(mn),
)
if err != nil {