fix: run tests in "dht server" mode
Otherwise, we'd need to wait a delay on start for nodes to start becoming servers.
Steven Allen committed
Apr 9, 2020 at 21:40 UTC
e55c688fca457c40d95bbe4c9c7d407bdda34219
2 files changed
+7
-4
core/coreapi/test/api_test.go
+5
-3
@@ -13,6 +13,7 @@ import (
13
"github.com/ipfs/go-ipfs/core/bootstrap"
14
"github.com/ipfs/go-ipfs/core/coreapi"
15
mock "github.com/ipfs/go-ipfs/core/mock"
16
+ "github.com/ipfs/go-ipfs/core/node/libp2p"
17
"github.com/ipfs/go-ipfs/keystore"
18
"github.com/ipfs/go-ipfs/repo"
19
@@ -78,9 +79,10 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
79
}
80
81
node, err := core.NewNode(ctx, &core.BuildCfg{
81
- Repo: r,
82
- Host: mock.MockHostOption(mn),
83
- Online: fullIdentity,
82
+ Routing: libp2p.DHTServerOption,
83
+ Repo: r,
84
+ Host: mock.MockHostOption(mn),
85
+ Online: fullIdentity,
86
ExtraOpts: map[string]bool{
87
"pubsub": true,
88
},
core/mock/mock.go
+2
-1
@@ -90,7 +90,8 @@ func MockPublicNode(ctx context.Context, mn mocknet.Mocknet) (*core.IpfsNode, er
90
}
91
cfg.Datastore = config.Datastore{}
92
return core.NewNode(ctx, &core.BuildCfg{
93
- Online: true,
93
+ Online: true,
94
+ Routing: libp2p2.DHTServerOption,
95
Repo: &repo.Mock{
96
C: *cfg,
97
D: ds,