support

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddedJobID

func AddedJobID(t *testing.T, result Result) string

func AssertPairOutcome

func AssertPairOutcome(t *testing.T, r Result)

func BuildRotari

func BuildRotari(path string) error

BuildRotari builds cmd/rotari at path for a conformance test binary. Commands that run the binary must call TrackBuildInputs.

func GuardedCommands

func GuardedCommands(project string) map[string][]string

GuardedCommands are the project commands that a running or interrupted project rejects. Queue edits are not among them: the queue holds only the next run's jobs.

func JobProcesses

func JobProcesses(t *testing.T, root, job string) int

func KillProcessGroup

func KillProcessGroup(pid int) error

func KillStrays

func KillStrays(t *testing.T, root string)

func KillSupervisors

func KillSupervisors(t *testing.T, root string)

KillSupervisors kills the supervisor processes of runs under root, as a crash would, and leaves their jobs running.

func MemoryTempDir added in v0.1.20

func MemoryTempDir(t *testing.T) string

MemoryTempDir returns a directory on /dev/shm when it is writable, removed when the test ends, and t.TempDir otherwise. jj syncs its operation log to disk on every snapshot, which takes seconds on a host busy with synchronous writes, so jj repositories made by tests live in memory.

func PairAdapter

func PairAdapter(command string) string

One execution classification shared by the inventory and runners. Missing adapters are deferred explicitly rather than counted as passing tests.

func PairHasFlag

func PairHasFlag(flags []PairFlag, name string) bool

func PairIntersect

func PairIntersect(a, b []string) []string

func PairMutationRevision

func PairMutationRevision(t *testing.T, e *Env) string

func Run

func Run(m *testing.M) int

func TrackBuildInputs

func TrackBuildInputs(t testing.TB)

TrackBuildInputs makes a cached test result depend on rotari's sources.

BuildRotari runs `go build` in a subprocess, which Go's test cache does not observe, so a cached conformance result would survive a change to rotari. The cache does record files the test process stats while tests run (not in TestMain), so every command that runs the built binary calls this: it stats each file under the module's cmd and internal directories, plus go.mod and go.sum, once per test binary.

func WaitForInterrupted

func WaitForInterrupted(t *testing.T, e *Env, project string)

func WaitUntil

func WaitUntil(t *testing.T, timeout time.Duration, done func() (bool, string))

Types

type ActiveRun

type ActiveRun struct {
	Project string
	RunID   string
	Jobs    []string
}

type CoordinatorProcess

type CoordinatorProcess struct {
	Host         string `json:"host"`
	PID          int    `json:"pid"`
	PIDNamespace string `json:"pid_namespace"`
	ProcessStart string `json:"process_start"`
}

func CurrentCoordinator

func CurrentCoordinator(t *testing.T) CoordinatorProcess

func ProcessIdentity

func ProcessIdentity(t *testing.T, pid int) CoordinatorProcess

type Env

type Env struct {
	T      *testing.T
	Root   string
	Base   string
	Master string
	// contains filtered or unexported fields
}

func NewEnv

func NewEnv(t *testing.T) *Env

func (*Env) CheckState

func (e *Env) CheckState(project string) string

func (*Env) Command

func (e *Env) Command(args ...string) *exec.Cmd

Command returns an unstarted rotari command in e's environment, for a test that talks to the process itself, such as over its stdin.

func (*Env) CreateFinishedRun

func (e *Env) CreateFinishedRun() FinishedRun

func (*Env) ExportFinishedRun

func (e *Env) ExportFinishedRun(project string) string

func (*Env) FinishedJobRun

func (e *Env) FinishedJobRun(project string) (runID, attemptID string)

func (*Env) HTTPDo

func (e *Env) HTTPDo(method, url string, headers map[string]string, body string) HTTPResult

HTTPDo sends one request with headers; a "Host" header sets the request's Host. body, when not empty, is sent as JSON.

func (*Env) HTTPGet

func (e *Env) HTTPGet(url string) HTTPResult

func (*Env) HTTPPostJSON

func (e *Env) HTTPPostJSON(url string, body any) HTTPResult

func (*Env) In

func (e *Env) In(dir string) *Env

In returns a copy of e whose commands run in dir.

func (*Env) JobExitStatus

func (e *Env) JobExitStatus(project, jobID string) string

func (*Env) MustRotari

func (e *Env) MustRotari(args ...string) Result

func (*Env) OrphanRun

func (e *Env) OrphanRun(project, script string) string

func (*Env) Rotari

func (e *Env) Rotari(args ...string) Result

func (*Env) RotariRun added in v0.1.20

func (e *Env) RotariRun(args ...string) Result

RotariRun runs a run or retry that must start a run, whatever its jobs do. A refusal to start also exits 1, like a run whose jobs failed, so it fails the test with the command's output unless a new run directory appeared in e's basedir or one the arguments name.

func (*Env) Setenv

func (e *Env) Setenv(name, value string)

Setenv sets name in the environment of e's later commands.

func (*Env) StartRun

func (e *Env) StartRun(project string, count int, async bool, runArgs ...string) ActiveRun

func (*Env) StartTableView

func (e *Env) StartTableView(path string, args ...string) string

StartTableView starts rotari tableview on path and returns its URL.

func (*Env) StartWeb

func (e *Env) StartWeb(args ...string) string

func (*Env) WithVar

func (e *Env) WithVar(name, value string) *Env

func (*Env) Without

func (e *Env) Without(name string) *Env

type FinishedRun

type FinishedRun struct {
	Project    string
	RunID      string
	OKJob      string
	BadJob     string
	BadAttempt string
}

type FlagPair

type FlagPair struct{ A, B PairFlag }

func CommandFlagPairs

func CommandFlagPairs(c PairCommand) []FlagPair

type HTTPResult

type HTTPResult struct {
	Status int
	Body   string
}

type PairCommand

type PairCommand struct {
	Name  string     `json:"name"`
	Flags []PairFlag `json:"flags"`
}

func ReadPairSchema

func ReadPairSchema(t *testing.T, e *Env) []PairCommand

type PairFixture

type PairFixture struct {
	E                                *Env
	Project, Run, Bad, Array, Config string
	Jobs                             []string
}

func NewPairFixture

func NewPairFixture(t *testing.T) PairFixture

func (PairFixture) Sample

func (f PairFixture) Sample(t *testing.T, flag PairFlag) []string

type PairFlag

type PairFlag struct {
	Name      string   `json:"name"`
	ValueName string   `json:"value_name"`
	Values    []string `json:"values"`
}

type PairMutationFixture

type PairMutationFixture struct {
	PairFixture
	Initial PairSavedTree
	// Current is the tree as last observed after an invocation; Restore
	// diffs against it.
	Current   *PairSavedTree
	Revision  string
	SecondRun string
	Manifest  string
}

func NewPairMutationFixture

func NewPairMutationFixture(t *testing.T) PairMutationFixture

type PairMutationResult

type PairMutationResult struct {
	Process Result
	State   map[string]string
}

type PairSavedFile

type PairSavedFile struct {
	Path string
	Mode fs.FileMode
	At   time.Time
	Data []byte
	Dir  bool
}

type PairSavedTree

type PairSavedTree []PairSavedFile

A byte-for-byte initial tree, including directory mtimes used by latest-run lookup. All paths are relative to the harness-owned temporary root. No active supervisor/job is allowed while this snapshot is captured or restored.

func SavePairTree

func SavePairTree(t *testing.T, root string) PairSavedTree

func (PairSavedTree) Observation

func (tree PairSavedTree) Observation(t *testing.T) map[string]string

Only the project's newly written meta.updated_at is nondeterministic. All other content (IDs, queue definitions, results, registry, modes) stays exact.

func (PairSavedTree) Raw

func (tree PairSavedTree) Raw() map[string]string

func (PairSavedTree) Restore

func (tree PairSavedTree) Restore(t *testing.T, root string, current PairSavedTree)

Restore returns root to tree, given current, the snapshot taken after the last invocation. It rewrites only entries that differ, which matters on network filesystems where rewriting the whole tree per invocation dominated the runtime. Every entry's path, type, mode, and modification time is then checked against tree; contents are exact because unchanged entries had equal contents in current and changed ones are rewritten from tree.

type Result

type Result struct {
	Args   []string
	Code   int
	Stdout string
	Stderr string
}

func PairInvoke

func PairInvoke(t *testing.T, e *Env, args ...string) Result

Adapters own isolation and restoration for mutating commands. Finished runs ensure --follow exits; the deadline is a failure bound, never an expected result.

func (Result) String

func (r Result) String() string

Jump to

Keyboard shortcuts

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