Documentation
¶
Overview ¶
Package tests contains integration and helper utilities used across distributed backend tests (non-exported in main module). Lint requires a package comment.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllocatePort ¶ added in v0.4.0
AllocatePort returns a free TCP loopback address ("127.0.0.1:N") for tests that need to bind a server. Listening on :0 lets the kernel pick an unused port; we close immediately and return the address. Two tests calling this concurrently can in theory collide on the same port if the kernel reissues it before either test binds, but in practice the window is too short to matter for our serial-package test runs.
Use this instead of hard-coded ports so that -shuffle and -count=N do not induce flake from port reuse across tests in the same process.
func FindOwnerKey ¶
func FindOwnerKey(b *backend.DistMemory, prefix string, desired []cluster.NodeID, limit int) (string, bool)
FindOwnerKey brute forces keys until it finds one whose owner ordering matches exactly ids.
func StopOnCleanup ¶ added in v0.4.0
func StopOnCleanup(tb testing.TB, b *backend.DistMemory)
StopOnCleanup registers Stop on t.Cleanup so background goroutines (heartbeat, hint-replay, rebalance, autosync, tombstone, gossip) and HTTP listeners do not leak across test iterations under -count=N -race.
nil-tolerant: if the backend creation failed, this is a no-op so callers can keep the existing pattern of `b, _ := backend.NewDistMemory(...)`.
Types ¶
This section is empty.