@cryptotaxi247 / kubo / commits / fb58b0ae8

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).

Hector Sanjuan committed Nov 26, 2024 at 19:19 UTC fb58b0ae85f43c938c50a55aa1f88d72c41c6eb3
1 file changed +13 -2
test/cli/delegated_routing_v1_http_proxy_test.go
+13 -2
@@ -15,9 +15,11 @@ func TestRoutingV1Proxy(t *testing.T) {
15 t.Parallel()
16
17 setupNodes := func(t *testing.T) harness.Nodes {
18 - nodes := harness.NewT(t).NewNodes(2).Init()
18 + nodes := harness.NewT(t).NewNodes(3).Init()
19
20 - // Node 0 uses DHT and exposes the Routing API.
20 + // Node 0 uses DHT and exposes the Routing API. For the DHT
21 + // to actually work there will need to be another DHT-enabled
22 + // node.
23 nodes[0].UpdateConfig(func(cfg *config.Config) {
24 cfg.Gateway.ExposeRoutingAPI = config.True
25 cfg.Discovery.MDNS.Enabled = false
@@ -49,6 +51,15 @@ func TestRoutingV1Proxy(t *testing.T) {
51 })
52 nodes[1].StartDaemon()
53
54 + // This is the second DHT node. Only used so that the DHT is
55 + // operative.
56 + nodes[2].UpdateConfig(func(cfg *config.Config) {
57 + cfg.Gateway.ExposeRoutingAPI = config.True
58 + cfg.Discovery.MDNS.Enabled = false
59 + cfg.Routing.Type = config.NewOptionalString("dht")
60 + })
61 + nodes[2].StartDaemon()
62 +
63 // Connect them.
64 nodes.Connect()
65