Documentation
¶
Overview ¶
Package run plans a run, collects through connectors, decides verdicts and applies the safeguard state rule.
Index ¶
- Variables
- func ApplyState(o *Outcome, prev *tag.Tag, retired *config.Retired)
- func DefaultPhaseTwo() map[string]bool
- func ExitCode(all []*Outcome, failOn string) int
- func SortOutcomes(all []*Outcome)
- func SortedKeys[V any](m map[string]V) []string
- func TestDir(dir string) (results map[string][]CaseResult, problems map[string]string, err error)
- func TestPath(drillFile string) string
- type Attention
- type CaseResult
- type Config
- type Options
- type Outcome
- type Result
- type Skip
- type TestCase
- type TestFile
Constants ¶
This section is empty.
Variables ¶
var Version = "0.0.1"
Version is set at build time.
Functions ¶
func ApplyState ¶
ApplyState works out state and what changed from the previous tag. A waiver that just expired on an open safeguard counts as newly open.
func DefaultPhaseTwo ¶
DefaultPhaseTwo names the connectors that depend on hosts from others.
func SortOutcomes ¶
func SortOutcomes(all []*Outcome)
SortOutcomes orders outcomes by drill and target.
func SortedKeys ¶
SortedKeys returns a map's keys in order.
Types ¶
type Attention ¶
type Attention struct {
NewlyOpen []*Outcome
NewlyClosed []*Outcome
OpenUnverified []*Outcome
ClosedUnverified []*Outcome
}
Attention is what leads every output.
func BuildAttention ¶
BuildAttention groups outcomes by what changed.
type CaseResult ¶
type CaseResult struct {
Name, Expect, Got, Reason string
}
CaseResult is one case's outcome.
func RunTests ¶
func RunTests(d *drill.Drill, data []byte) ([]CaseResult, error)
RunTests runs a drill's fixtures. It fails a file that lacks a passing, a failing or a not-applicable case.
func (CaseResult) OK ¶
func (c CaseResult) OK() bool
OK reports whether the case gave the expected verdict.
type Config ¶
type Config struct {
Project *config.Project
Drills []*drill.Drill
Connectors []connector.Connector
Scope connector.Scope
Stream string // local or ci
RanBy string
Records string // directory holding tags/ and snapshots/
// WriteRecords is false in a public repo, where only counts may be printed.
WriteRecords bool
DryRun bool
PhaseTwo map[string]bool // connectors that read what others wrote
}
Config is one run's inputs.
type Options ¶
type Options struct {
Now time.Time
Available map[string]bool // connectors that can run
Failures map[string]string
Waivers []config.Waiver
// Fixture, when set, answers every fetch from these values by alias instead
// of the graph. It is how drill test files run.
Fixture map[string]facts.Result
// Record, when set, receives each fetched fact result by alias.
Record func(alias string, r facts.Result)
}
Options controls decisions.
type Outcome ¶
type Outcome struct {
Drill *drill.Drill
Target string
TargetAttrs map[string]any
Verdict string
Reason string
Conditions []tag.Condition
Facts map[string]any
Read []graph.ID
Sources map[string]string
Waived bool
Waivers []config.Waiver
WaivedParts int
Owner string
Prev string
State string
NewlyOpen bool
NewlyClosed bool
Unverified string
Retired string
}
Outcome is one verdict on one target.
type Result ¶
type Result struct {
Outcomes []*Outcome
Attention Attention
Skips []Skip
Graph *graph.Graph
Calls []string // printed by --dry-run
Fatal string
Stream string
Available map[string]bool
Failures map[string]string
}
Result is one run's outputs.
type TestCase ¶
type TestCase struct {
Name string `yaml:"name"`
Expect string `yaml:"expect"`
Target map[string]any `yaml:"target,omitempty"`
Facts map[string]any `yaml:"facts"`
Inspected map[string]int `yaml:"inspected,omitempty"`
Partial map[string]string `yaml:"partial,omitempty"`
}
TestCase gives the fact values for one setup and the verdict they must give.