Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SweepOrphans ¶
func SweepOrphans(ctx context.Context, client *circleci.Client, orgID string, status iostream.StatusFunc) int
SweepOrphans deletes sidecars in the org left behind by an earlier variants run. It is a backstop, not the primary cleanup: Run deletes its own sidecars and the signal handler covers interrupts, but a crash or a lost network connection can still strand one, and nothing else will ever collect it.
Only names carrying namePrefix and older than orphanAfter are touched, so a concurrent run's in-flight sidecars survive. Deletion failures are reported and skipped rather than aborting the sweep — a stale entry the API refuses to delete must not block the run the caller actually asked for.
Types ¶
type Command ¶
Command is one validation command to run on each variant's sidecar.
Run must already be expanded by the caller: a command carrying an unexpanded {{CHANGED_PACKAGES}} exits non-zero in the shell, which this package would otherwise read as a killed mutant.
type Options ¶
type Options struct {
OrgID string
Image string
IdentityFile string
AuthSock string
Workspace string // remote working directory, must be non-empty
Parallel int // max concurrent sidecars (default 5)
Commands []Command // commands to run on each sidecar in order
StatusFn iostream.StatusFunc
}
Options holds all configuration for running variants.
type Result ¶
type Result struct {
ID string `json:"id"`
Description string `json:"description"`
Killed bool `json:"killed"`
// Command names the validation command that produced the verdict, so a kill
// can be traced to the command that caught it and a failure to the command
// that could not run.
Command string `json:"command,omitempty"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exit_code"`
Error string `json:"error,omitempty"`
}
Result is one entry in the output JSON array.
Killed and Error are mutually exclusive. Killed means the test suite ran and failed, which is a caught mutant. A non-empty Error means the mutant was never assessed — the sidecar died, the patch would not apply, the command was not on the image, the suite never finished. Those must not be reported as kills: an environmental failure that reads as a caught mutant turns a broken run into a clean bill of health, which is the one direction this tool must not fail in.
func Run ¶
func Run(ctx context.Context, client *circleci.Client, variants []Variant, opts Options) ([]Result, error)
Run executes all variants in parallel and returns results in input order. It only returns an error for fatal pre-flight failures; per-variant errors are captured in Result.Error.
Run installs its own SIGINT/SIGTERM handler for the duration of the call. Without it an interrupt kills the process outright, every deferred DeleteSidecar is skipped, and each in-flight sidecar is left running and billing. Catching the signal turns it into a context cancellation that unwinds through those defers instead.