harness

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	APIVersionV1 = "v1"
	KindHarness  = "Harness"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Expectation

type Expectation struct {
	RunStatus     string              `yaml:"runStatus,omitempty"`
	ErrorContains string              `yaml:"errorContains,omitempty"`
	Tasks         []TaskExpectation   `yaml:"tasks,omitempty"`
	Metrics       []MetricExpectation `yaml:"metrics,omitempty"`
	Lineage       *LineageExpectation `yaml:"lineage,omitempty"`
}

Expectation describes the asserted outcome of a scenario run.

type File

type File struct {
	APIVersion string     `yaml:"apiVersion"`
	Kind       string     `yaml:"kind"`
	Scenarios  []Scenario `yaml:"scenarios"`
}

File models a harness scenario manifest consumed by `caesium test --scenario`.

func (*File) Validate

func (f *File) Validate() error

type ImpactExpectation

type ImpactExpectation struct {
	// Dataset is the root dataset name whose downstream impact is queried
	// (e.g. "<job-alias>.<step>.output").
	Dataset string `yaml:"dataset"`
	// Namespace overrides the dataset namespace; defaults to the harness
	// namespace when empty.
	Namespace string `yaml:"namespace,omitempty"`
	// MaxDepth bounds the downstream BFS (0 = unbounded).
	MaxDepth int `yaml:"maxDepth,omitempty"`
	// Downstream lists dataset names that must appear in the impact result.
	Downstream []string `yaml:"downstream"`
}

ImpactExpectation asserts the persisted lineage graph (the data the /lineage/impact query reads), not just the emitted events: that a root dataset reaches the expected downstream consumers. This catches regressions where datasets are emitted but never persisted, so impact comes back empty.

type LineageExpectation

type LineageExpectation struct {
	TotalEvents *int                `yaml:"totalEvents,omitempty"`
	EventTypes  map[string]int      `yaml:"eventTypes,omitempty"`
	JobNames    []string            `yaml:"jobNames,omitempty"`
	Impact      []ImpactExpectation `yaml:"impact,omitempty"`
}

LineageExpectation describes emitted OpenLineage assertions.

type MetricExpectation

type MetricExpectation struct {
	Name   string            `yaml:"name"`
	Labels map[string]string `yaml:"labels,omitempty"`
	Value  *float64          `yaml:"value,omitempty"`
	Delta  *float64          `yaml:"delta,omitempty"`
}

MetricExpectation describes one Prometheus metric assertion.

type MetricObservation

type MetricObservation struct {
	Name   string
	Labels map[string]string
	Value  float64
	Delta  float64
}

MetricObservation is the measured value for one asserted metric.

type ResolvedScenario

type ResolvedScenario struct {
	Scenario   Scenario
	SourcePath string
}

ResolvedScenario is a validated scenario with its source location.

func CollectScenarios

func CollectScenarios(paths []string) ([]ResolvedScenario, error)

CollectScenarios loads harness scenarios from files or directories.

func (ResolvedScenario) Definition

func (r ResolvedScenario) Definition() (*jobdef.Definition, error)

Definition loads and selects the job definition targeted by the scenario.

type Result

type Result struct {
	Scenario           ResolvedScenario
	Run                *localrun.RunResult
	ExecutionError     error
	MetricObservations []MetricObservation
	LineageEvents      []lineage.RunEvent
	Failures           []string
}

Result is the evaluated outcome of one scenario execution.

func Execute

func Execute(ctx context.Context, scenario ResolvedScenario) (*Result, error)

Execute runs one scenario and evaluates its expectations.

func (*Result) Passed

func (r *Result) Passed() bool

Passed reports whether the scenario met all expectations.

type Scenario

type Scenario struct {
	Name        string        `yaml:"name"`
	Path        string        `yaml:"path"`
	Alias       string        `yaml:"alias,omitempty"`
	MaxParallel int           `yaml:"maxParallel,omitempty"`
	TaskTimeout time.Duration `yaml:"taskTimeout,omitempty"`
	RunTimeout  time.Duration `yaml:"runTimeout,omitempty"`
	Expect      Expectation   `yaml:"expect"`
}

Scenario defines one executable harness case.

func (*Scenario) Validate

func (s *Scenario) Validate() error

type TaskExpectation

type TaskExpectation struct {
	Name                 string            `yaml:"name"`
	Status               string            `yaml:"status,omitempty"`
	Output               map[string]string `yaml:"output,omitempty"`
	LogContains          []string          `yaml:"logContains,omitempty"`
	SchemaViolationCount *int              `yaml:"schemaViolationCount,omitempty"`
	CacheHit             *bool             `yaml:"cacheHit,omitempty"`
	ErrorContains        string            `yaml:"errorContains,omitempty"`
}

TaskExpectation describes assertions for one task.

Jump to

Keyboard shortcuts

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