Documentation
¶
Index ¶
- func FossilArtifactByPath(repoPath, uuid string) ([]byte, error)
- func FossilBinary() string
- func FossilRebuild(repoPath string) error
- func FossilTimeline(repoPath string) ([]byte, error)
- func IsolateFossilHome(t *testing.T) string
- func RequireFossilBin(t *testing.T) string
- func StartServer(t *testing.T, bin string, args ...string) *exec.Cmd
- type TestRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FossilArtifactByPath ¶
func FossilBinary ¶
func FossilBinary() string
FossilBinary resolves the canonical fossil binary: the FOSSIL_BIN override first, then PATH. An override that does not resolve to an executable is treated as no binary at all, so the caller reports "fossil not found" rather than letting a stale path surface later as a raw fork/exec error.
func FossilRebuild ¶
func FossilTimeline ¶
func IsolateFossilHome ¶ added in v0.12.0
IsolateFossilHome points HOME, FOSSIL_HOME and XDG_CONFIG_HOME at a fresh per-test directory for the rest of the test, and returns it. Fossil keeps a per-user database (~/.fossil or ~/.config/fossil.db) and records every repository and checkout it touches there, never removing the rows; without this, each test run leaks rows into the developer's real config and contends for its lock (#284). Child processes inherit the environment, so every exec.Command in the test is covered without per-call plumbing. RequireFossilBin calls it, so a test that resolves the binary through that gets isolation by default; tests that resolve fossil another way must call it themselves (TestFossilInvocationsIsolateHome enforces this). It cannot be used from a parallel test: t.Setenv panics there, which is the intended loud failure, since a shared process environment cannot be isolated per test.
func RequireFossilBin ¶
RequireFossilBin resolves the fossil binary for tests that need canonical Fossil to run. It resolves the same way FossilBinary does (the FOSSIL_BIN override, then PATH). When no binary is found it skips the test, unless REQUIRE_FOSSIL_BIN=1 is set -- then it fails. That makes CI turn a missing binary into a loud failure (verifying real Fossil reads what we write is the one thing our own tests cannot substitute for) while local runs without fossil installed stay an opt-in skip.
func StartServer ¶ added in v0.12.0
StartServer runs `bin args...` as a long-lived server and stops it when the test ends. The server gets its own process group and cleanup kills the whole group before reaping the parent. `fossil server` forks a child per connection, so killing only the parent leaves a child that can still write journal/WAL files while t.TempDir()'s RemoveAll walks the directory, which fails cleanup with "directory not empty" (#352).
Call it after t.TempDir() so its cleanup runs first (Cleanup is LIFO).