kubo/config/bootstrap_peers_test.go
Marcin Rataj ccb49de852
Some checks failed
CodeQL / codeql (push) Has been cancelled
Docker Build / docker-build (push) Has been cancelled
Gateway Conformance / gateway-conformance (push) Has been cancelled
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Has been cancelled
Go Build / go-build (push) Has been cancelled
Go Check / go-check (push) Has been cancelled
Go Lint / go-lint (push) Has been cancelled
Go Test / go-test (push) Has been cancelled
Interop / interop-prep (push) Has been cancelled
Sharness / sharness-test (push) Has been cancelled
Spell Check / spellcheck (push) Has been cancelled
Interop / helia-interop (push) Has been cancelled
Interop / ipfs-webui (push) Has been cancelled
feat(config): AutoConf with "auto" placeholders (#10883)
https://github.com/ipfs/kubo/pull/10883
https://github.com/ipshipyard/config.ipfs-mainnet.org/issues/3

---------

Co-authored-by: gammazero <gammazero@users.noreply.github.com>
2025-08-20 05:59:11 +02:00

29 lines
922 B
Go

package config
import (
"testing"
"github.com/ipfs/boxo/autoconf"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestBootstrapPeerStrings(t *testing.T) {
// Test round-trip: string -> parse -> format -> string
// This ensures that parsing and formatting are inverse operations
// Start with the default bootstrap peer multiaddr strings
originalStrings := autoconf.FallbackBootstrapPeers
// Parse multiaddr strings into structured peer data
parsed, err := ParseBootstrapPeers(originalStrings)
require.NoError(t, err, "parsing bootstrap peers should succeed")
// Format the parsed data back into multiaddr strings
formattedStrings := BootstrapPeerStrings(parsed)
// Verify round-trip: we should get back exactly what we started with
assert.ElementsMatch(t, originalStrings, formattedStrings,
"round-trip through parse/format should preserve all bootstrap peers")
}