kubo/test/cli/dht_opt_prov_test.go
Andrew Gillis b8a1aa471c
Some checks are pending
CodeQL / codeql (push) Waiting to run
Docker Build / docker-build (push) Waiting to run
Gateway Conformance / gateway-conformance (push) Waiting to run
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Waiting to run
Go Build / go-build (push) Waiting to run
Go Check / go-check (push) Waiting to run
Go Lint / go-lint (push) Waiting to run
Go Test / go-test (push) Waiting to run
Interop / interop-prep (push) Waiting to run
Interop / helia-interop (push) Blocked by required conditions
Interop / ipfs-webui (push) Blocked by required conditions
Sharness / sharness-test (push) Waiting to run
Spell Check / spellcheck (push) Waiting to run
chore: replace random test utils with equivalents in go-test/random (#10915)
Replace test functionality that is dublicated in go-test/random
2025-08-14 10:37:55 -07:00

31 lines
736 B
Go

package cli
import (
"testing"
"github.com/ipfs/go-test/random"
"github.com/ipfs/kubo/config"
"github.com/ipfs/kubo/test/cli/harness"
"github.com/stretchr/testify/assert"
)
func TestDHTOptimisticProvide(t *testing.T) {
t.Parallel()
t.Run("optimistic provide smoke test", func(t *testing.T) {
nodes := harness.NewT(t).NewNodes(2).Init()
nodes[0].UpdateConfig(func(cfg *config.Config) {
cfg.Experimental.OptimisticProvide = true
})
nodes.StartDaemons().Connect()
hash := nodes[0].IPFSAddStr(string(random.Bytes(100)))
nodes[0].IPFS("routing", "provide", hash)
res := nodes[1].IPFS("routing", "findprovs", "--num-providers=1", hash)
assert.Equal(t, nodes[0].PeerID().String(), res.Stdout.Trimmed())
})
}