From e55c688fca457c40d95bbe4c9c7d407bdda34219 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 9 Apr 2020 21:40:22 -0700 Subject: [PATCH] fix: run tests in "dht server" mode Otherwise, we'd need to wait a delay on start for nodes to start becoming servers. --- core/coreapi/test/api_test.go | 8 +++++--- core/mock/mock.go | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/coreapi/test/api_test.go b/core/coreapi/test/api_test.go index f3e3903bc..153a8c7cf 100644 --- a/core/coreapi/test/api_test.go +++ b/core/coreapi/test/api_test.go @@ -13,6 +13,7 @@ import ( "github.com/ipfs/go-ipfs/core/bootstrap" "github.com/ipfs/go-ipfs/core/coreapi" mock "github.com/ipfs/go-ipfs/core/mock" + "github.com/ipfs/go-ipfs/core/node/libp2p" "github.com/ipfs/go-ipfs/keystore" "github.com/ipfs/go-ipfs/repo" @@ -78,9 +79,10 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int) } node, err := core.NewNode(ctx, &core.BuildCfg{ - Repo: r, - Host: mock.MockHostOption(mn), - Online: fullIdentity, + Routing: libp2p.DHTServerOption, + Repo: r, + Host: mock.MockHostOption(mn), + Online: fullIdentity, ExtraOpts: map[string]bool{ "pubsub": true, }, diff --git a/core/mock/mock.go b/core/mock/mock.go index 673a54b86..ed123dff7 100644 --- a/core/mock/mock.go +++ b/core/mock/mock.go @@ -90,7 +90,8 @@ func MockPublicNode(ctx context.Context, mn mocknet.Mocknet) (*core.IpfsNode, er } cfg.Datastore = config.Datastore{} return core.NewNode(ctx, &core.BuildCfg{ - Online: true, + Online: true, + Routing: libp2p2.DHTServerOption, Repo: &repo.Mock{ C: *cfg, D: ds,