Documentation
¶
Overview ¶
Package testutil provides shared test helpers for internal packages.
Index ¶
- func ConfigureGitReadMarkers(t *testing.T, root string) string
- func Context(t testing.TB) context.Context
- func EqualStringSlices(left, right []string) bool
- func Eventually(t testing.TB, label string, budget time.Duration, condition func() bool)
- func FreeTCPPort(t testing.TB) int
- func HermeticProcessEnv(base []string) []string
- func Receive[T any](t testing.TB, label string, budget time.Duration, ch <-chan T) T
- func Scaled(t testing.TB, budget time.Duration) time.Duration
- func TimeScale() int
- type HermeticEnv
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureGitReadMarkers ¶
ConfigureGitReadMarkers installs repository-configured programs that leave a marker if executed.
func EqualStringSlices ¶
EqualStringSlices reports whether two string slices have equal contents.
func Eventually ¶
Eventually polls condition until it reports true and fails t with label once the race-scaled budget elapses. Prefer Receive when the code under test exposes a channel, watcher or event signal; poll only state that has none.
func FreeTCPPort ¶
FreeTCPPort returns an available localhost TCP port chosen from a per-process pseudo-random walk through a high, non-default port range. The listener is closed before returning, so callers still need to bind quickly, but this avoids repeated reuse of the same ephemeral port under parallel package execution.
func HermeticProcessEnv ¶
HermeticProcessEnv returns a child-process environment with credential-shaped and Compozy/provider-local state removed, plus deterministic timezone and locale pins. It intentionally leaves HOME untouched; tests that need isolated Compozy state should set COMPOZY_HOME explicitly after calling this helper.
func Receive ¶
Receive waits for one value from ch and fails t with label once the race-scaled budget elapses. A closed channel yields the zero value, so it also waits for done-style signals.
Types ¶
type HermeticEnv ¶
type HermeticEnv struct {
HomeDir string
ConfigHomeDir string
ProviderHomeDir string
ProviderCodexDir string
ClaudeConfigDir string
CodexHomeDir string
OpenCodeHomeDir string
}
HermeticEnv captures deterministic environment paths applied by ApplyHermeticEnv.
func ApplyHermeticEnv ¶
func ApplyHermeticEnv(t testing.TB) HermeticEnv
ApplyHermeticEnv scrubs ambient credentials and pins deterministic env values for tests that intentionally exercise process environment, COMPOZY_HOME, provider home, or release shell behavior. It mutates process environment and therefore must not be used by tests that call t.Parallel.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd/acpmock-driver
command
|
|
|
Package mcpfixture provides deterministic official-MCP-SDK fixtures for runtime and OAuth integration tests.
|
Package mcpfixture provides deterministic official-MCP-SDK fixtures for runtime and OAuth integration tests. |
|
Package otlptest runs an in-process OTLP collector (HTTP or gRPC) for tests that export through the daemon's real telemetry runtime: the providers telemetry.Init installs, the sanitizing exporters, and the OTLP exporters.
|
Package otlptest runs an in-process OTLP collector (HTTP or gRPC) for tests that export through the daemon's real telemetry runtime: the providers telemetry.Init installs, the sanitizing exporters, and the OTLP exporters. |