testrunner

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package testrunner implements `flate test`.

The runner takes the post-reconcile state of the orchestrator and reports it in a pytest-like progress format. It does NOT shell out to the Go toolchain — every check is performed natively against the Store. A test "passes" when its Kustomization (and every nested HelmRelease) reached Status.Ready; it "fails" otherwise. Resources that were skipped by --path-orig change filtering are reported as SKIPPED so users see what flate actually did.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Case

type Case struct {
	ID      manifest.NamedResource
	Outcome Outcome
	Reason  string
}

Case is one Kustomization (or HelmRelease) result.

type Job

type Job struct {
	Store *store.Store
	// Kinds limits the kinds reported on. Empty ↦ both Kustomization
	// and HelmRelease.
	Kinds []string
	// Name optionally narrows the report to a single resource.
	Name string
	// Include optionally narrows the report by resource identity.
	// Nil includes every resource that passes Kinds and Name.
	Include func(manifest.NamedResource) bool
}

Job collects the orchestrator's post-run state.

type Outcome

type Outcome int

Outcome enumerates the per-resource result.

const (
	OutcomePassed Outcome = iota
	OutcomeSkipped
	OutcomeFailed
	// OutcomeBlocked is a resource that failed only because a dependency
	// failed or was missing — the body never ran. Blocked cases render after
	// the roster, each naming the root cause(s) it traces to.
	OutcomeBlocked
)

Possible Outcome values.

type Report

type Report struct {
	Cases   []Case
	Passed  int
	Skipped int
	Failed  int
	// Blocked holds one Case per resource whose dependency failed or was
	// missing — the body never ran. They render after the roster, each naming
	// the root cause(s) it traces to (see blockedCases).
	Blocked []Case
	Matched int
}

Report is the aggregate outcome.

func Run

func Run(j Job) Report

Run inspects the store and produces a Report. When j.Kinds is empty, both reconciler-driven kinds (Kustomization, HelmRelease) are reported on.

func (Report) AnyFailed

func (r Report) AnyFailed() bool

AnyFailed reports whether the run should be considered failed: a primary failure, or a cascade blocked on one. A broken dependency that blocks everything downstream must still flip the exit code even if nothing reported a primary failure in scope.

func (Report) Write

func (r Report) Write(w io.Writer, warnings []manifest.Warning, notes []report.Note, color bool, elapsed time.Duration) error

Write renders the whole `flate test` report to w as one document: the roster (one row per case, then one per blocked resource), then the render advisories (warnings) and deferred operational logs (notes), then a single verdict — composed through the shared report toolkit so the test surface and the build/diff report speak one spacing and verdict grammar. Failures already appear inline on their roster rows, so this is the complete picture: there is no separate failure block to print elsewhere. color gates the ANSI codes — the caller decides based on the sink (see cli.test).

Jump to

Keyboard shortcuts

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