testrunner

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 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 BlockedGroup added in v0.4.3

type BlockedGroup struct {
	Root    manifest.NamedResource
	Count   int
	Missing bool
}

BlockedGroup folds the resources that cascaded from one root cause into a single reported line: Count resources blocked by Root. Missing is true when Root was never loaded (a dependency that does not exist), false when Root is a failure reported elsewhere in the table.

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. These are folded under
	// their root cause rather than listed per-resource (see Report.Write).
	OutcomeBlocked
)

Possible Outcome values.

type Report

type Report struct {
	Cases   []Case
	Passed  int
	Skipped int
	Failed  int
	// Blocked counts resources folded under a root cause (not listed as
	// Cases); BlockedRoots names those roots with their tallies.
	Blocked      int
	BlockedRoots []BlockedGroup
	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, color bool, elapsed time.Duration) error

Write renders the report: one row per case (status glyph, dimmed kind column, namespace/name, dimmed reason) followed by a summary — an overall verdict glyph, the colored counts, and a dim elapsed clock (omitted when zero). 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