Help us shape the future of Go! Take the 2026 Go Developer Survey

runner

package
v0.3.2-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package runner tracks test stability and quarantine decisions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerSandbox

type DockerSandbox struct {
	Root        string
	Image       string
	ModuleCache string
	GoCache     string
	GoRoot      string
	TestCommand []string
	Profile     *ProjectProfile
}

DockerSandbox tests a patch in an ephemeral workspace copy inside a hardened, network-isolated Docker container.

func (DockerSandbox) ApplyAndTest

func (s DockerSandbox) ApplyAndTest(ctx context.Context, diff string) error

ApplyAndTest validates and applies the patch in a disposable copy, then runs the configured command without network, Linux capabilities, or privilege gain.

type ProfileMount

type ProfileMount struct{ Source, Destination, Mode string }

ProfileMount describes a bind mount relative to the copied workspace or host.

type ProjectProfile

type ProjectProfile struct {
	Image             string         `json:"image"`
	Dockerfile        string         `json:"dockerfile,omitempty"`
	TestCommand       []string       `json:"test_command"`
	Mounts            []ProfileMount `json:"mounts,omitempty"`
	Ecosystem         string         `json:"ecosystem"`
	CommandOverridden bool           `json:"command_overridden,omitempty"`
}

ProjectProfile contains a detected offline sandbox configuration.

func DetectProjectProfile

func DetectProjectProfile(repoDir string) (ProjectProfile, error)

DetectProjectProfile selects a conventional sandbox from repository manifests.

func (ProjectProfile) ScopedTestCommand

func (p ProjectProfile) ScopedTestCommand(tests []string) []string

ScopedTestCommand returns only mapped tests when available, or the full suite.

type QuarantineStore

type QuarantineStore struct {
	// contains filtered or unexported fields
}

QuarantineStore stores a bounded rolling history of test outcomes in SQLite.

func OpenQuarantine

func OpenQuarantine(path string, window int) (*QuarantineStore, error)

OpenQuarantine opens or creates the SQLite database at path.

func (*QuarantineStore) Close

func (q *QuarantineStore) Close() error

Close closes the backing database.

func (*QuarantineStore) Quarantined

func (q *QuarantineStore) Quarantined(ctx context.Context, testName string, threshold float64) (bool, float64, error)

Quarantined reports whether the rolling transition rate exceeds threshold.

func (*QuarantineStore) QuarantinedForHash

func (q *QuarantineStore) QuarantinedForHash(ctx context.Context, testName, astHash string, threshold float64) (bool, float64, error)

QuarantinedForHash checks a test's score only for the supplied AST revision.

func (*QuarantineStore) QuarantinedTests

func (q *QuarantineStore) QuarantinedTests(ctx context.Context, threshold float64) ([]string, error)

QuarantinedTests lists names whose rolling transition rate exceeds threshold.

func (*QuarantineStore) Record

func (q *QuarantineStore) Record(ctx context.Context, testName string, passed bool, at time.Time) error

Record appends a test result and trims older history beyond the configured window.

func (*QuarantineStore) RecordForHash

func (q *QuarantineStore) RecordForHash(ctx context.Context, testName, astHash string, passed bool, at time.Time) error

RecordForHash records a result within a test's exact source/AST identity.

func (*QuarantineStore) Score

func (q *QuarantineStore) Score(ctx context.Context, testName string) (float64, error)

Score returns the rolling transition rate between pass and fail outcomes.

func (*QuarantineStore) ScoreForHash

func (q *QuarantineStore) ScoreForHash(ctx context.Context, testName, astHash string) (float64, error)

ScoreForHash returns the rolling failure fraction for one exact AST identity. A uniformly failing test is not classified as flaky; both pass and fail observations must occur before the failure fraction is meaningful.

Jump to

Keyboard shortcuts

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