Documentation
¶
Overview ¶
Package testutil provides shared test helpers for saving per-test artifacts to persistent output directories.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RepoRoot ¶ added in v0.9.0
func RepoRoot() string
RepoRoot returns the project root by walking up from the caller's source file to the nearest directory containing go.mod.
func RunTimestamp ¶
func RunTimestamp() string
RunTimestamp returns a stable timestamp for the current test binary run. All tests in the same `go test` invocation share the same value.
func ShortSHA ¶ added in v0.9.0
func ShortSHA() string
ShortSHA returns the abbreviated commit hash of HEAD.
func TestResultsDir ¶ added in v0.9.0
TestResultsDir returns a persistent results directory for a test:
test/results/<timestamp>-<RootTestName>/<subtest/path>/
All subtests of the same root test share one timestamped parent directory. The directory is created automatically.
baseDirFn optionally overrides the base directory (the directory containing test/results/). When nil, RepoRoot() is used. Pass a custom function when the results path must be remapped (e.g. Docker host path translation).
Types ¶
This section is empty.