testutil

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package testutil provides shared test helpers for internal packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(t testing.TB) context.Context

Context returns a context canceled during test cleanup.

func EqualStringSlices

func EqualStringSlices(left, right []string) bool

EqualStringSlices reports whether two string slices have equal contents.

func FreeTCPPort

func FreeTCPPort(t testing.TB) int

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

func HermeticProcessEnv(base []string) []string

HermeticProcessEnv returns a child-process environment with credential-shaped and AGH/provider-local state removed, plus deterministic timezone and locale pins. It intentionally leaves HOME untouched; tests that need isolated AGH state should set AGH_HOME explicitly after calling this helper.

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, AGH_HOME, provider home, or release shell behavior. It mutates process environment and therefore must not be used by tests that call t.Parallel.

Directories

Path Synopsis
Package e2e provides shared runtime and artifact helpers for daemon-level end-to-end tests.
Package e2e provides shared runtime and artifact helpers for daemon-level end-to-end tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL