Skip to content

Commit

Permalink
tests/cli: fix flapping tests (#10600)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
hsanjuan authored Nov 26, 2024
1 parent 37c5060 commit fb58b0a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/cli/delegated_routing_v1_http_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit fb58b0a

Please sign in to comment.