Documentation
¶
Overview ¶
Package plan parses and validates testfleet acceptance plans (plan.yaml) and computes a stable plan_hash.
The plan_hash is the cornerstone of reproducible batch acceptance: it is a sha256 over the *normalized* entries (name + dir + resolved selector, in authored order), NOT over the raw file bytes. This makes it insensitive to YAML whitespace, comments, and intra-entry field order, but sensitive to the logical content (which dirs, which selectors, in which order). Re-running the same plan under a new staging version therefore yields the same plan_hash, while editing the plan changes it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyPlan = errors.New("empty plan")
ErrEmptyPlan marks a plan with zero entries. The cmd layer maps this to output.ErrEmptyPlan.
var ErrInvalidPlan = errors.New("invalid plan")
ErrInvalidPlan marks a structurally invalid plan (bad version, missing name/dir, duplicate name, both selectors set, malformed YAML). The cmd layer maps this to output.ErrInvalidPlan.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Name string `yaml:"name" json:"name"`
Dir string `yaml:"dir" json:"dir"`
Machine string `yaml:"machine,omitempty" json:"machine,omitempty"`
Tag string `yaml:"tag,omitempty" json:"tag,omitempty"`
}
Entry is one planned test dispatch: a named test dir plus a machine selector (machine XOR tag). After Load/Synthesize validation, exactly one of Machine or Tag is non-empty (entries lacking both are filled with the default tag).
type Plan ¶
type Plan struct {
Version int `yaml:"version" json:"version"`
Entries []Entry `yaml:"entries" json:"entries"`
// contains filtered or unexported fields
}
Plan is a parsed, validated acceptance plan.
func Load ¶
Load reads and validates a plan.yaml. defaultTag fills entries that specify neither machine nor tag. Returns ErrInvalidPlan / ErrEmptyPlan (wrapped, with detail) on validation failure, or a read/parse error otherwise.
func Synthesize ¶
Synthesize builds an inline plan from positional dirs. A machine XOR tag selector overrides the per-entry default; entries with neither fall back to defaultTag. Entry names derive from dir basenames (disambiguated on clash).
func (*Plan) Hash ¶
Hash returns the sha256 hex of the canonical JSON of the normalized entries, in authored order.
func (*Plan) ResolveDir ¶
ResolveDir resolves an entry's dir for dispatch. Relative dirs join against the plan file's directory; absolute dirs pass through unchanged. Inline plans (no baseDir) return the dir as-authored.