mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
tests/cli: fix flapping tests (#10600)
The issue is that for dht providing to work correctly, at least two nodes must have dht routing. Before, dht providing in the test always failed, but the test succeeded when the tested-CID was the one that the failure happened with (the first in the list for ProvideMany).
This commit is contained in:
parent
37c5060742
commit
fb58b0ae85
@ -15,9 +15,11 @@ func TestRoutingV1Proxy(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
setupNodes := func(t *testing.T) harness.Nodes {
|
||||
nodes := harness.NewT(t).NewNodes(2).Init()
|
||||
nodes := harness.NewT(t).NewNodes(3).Init()
|
||||
|
||||
// Node 0 uses DHT and exposes the Routing API.
|
||||
// Node 0 uses DHT and exposes the Routing API. For the DHT
|
||||
// to actually work there will need to be another DHT-enabled
|
||||
// node.
|
||||
nodes[0].UpdateConfig(func(cfg *config.Config) {
|
||||
cfg.Gateway.ExposeRoutingAPI = config.True
|
||||
cfg.Discovery.MDNS.Enabled = false
|
||||
@ -49,6 +51,15 @@ func TestRoutingV1Proxy(t *testing.T) {
|
||||
})
|
||||
nodes[1].StartDaemon()
|
||||
|
||||
// This is the second DHT node. Only used so that the DHT is
|
||||
// operative.
|
||||
nodes[2].UpdateConfig(func(cfg *config.Config) {
|
||||
cfg.Gateway.ExposeRoutingAPI = config.True
|
||||
cfg.Discovery.MDNS.Enabled = false
|
||||
cfg.Routing.Type = config.NewOptionalString("dht")
|
||||
})
|
||||
nodes[2].StartDaemon()
|
||||
|
||||
// Connect them.
|
||||
nodes.Connect()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user