e2e

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

pkg/e2e

e2e runs a declarative end-to-end test against a real Kubernetes cluster. Give it a spec file and it orchestrates the full lifecycle — cluster creation, CRD apply, operator install, CR apply, expectation checking, and cleanup — the same way locally and in CI.

ork e2e -f e2e.yaml

Developer documentation

I want to… Go to
Understand the spec file format and all fields docs/01-spec.md
Understand how expectations are evaluated (resources, commands, polling) docs/02-expectations.md
Understand the full run pipeline (what happens in order) docs/03-pipeline.md
Understand cluster lifecycle (kind, reuse, context restore) docs/04-cluster.md

Documentation

Overview

Package e2e implements the orchestration loop for `ork e2e`.

A Runner executes a declarative E2E spec through its full lifecycle:

  1. Cluster provisioning (kind) — skipped when --use-current or --cluster is set
  2. CRD apply
  3. Optional setup manifests
  4. Bundle generate + apply
  5. Orkestra helm install
  6. CR apply
  7. Expectation polling
  8. Teardown — always runs for non-owned clusters (--use-current, --cluster); for owned clusters only when --keep-cluster is absent

Teardown reverses every applied resource in the correct order: CR delete → helm uninstall → bundle delete → setup (reverse) → CRDs. This keeps borrowed clusters clean regardless of pass/fail.

Run returns a *Result with per-case timings that callers (e.g. registry push) embed as OCI annotations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaseResult

type CaseResult struct {
	Name    string
	Passed  bool
	Elapsed time.Duration
	Err     error
}

CaseResult holds the outcome of a single expectation.

type Result

type Result struct {
	Name    string
	Cases   []CaseResult
	Elapsed time.Duration
}

Result holds the outcome of a complete E2E run. It is returned by Run and consumed by ork registry push to embed verification metadata into OCI annotations.

func (*Result) AllPassed

func (r *Result) AllPassed() bool

AllPassed returns true when every expectation passed.

func (*Result) Duration

func (r *Result) Duration() string

Duration returns the total elapsed time as a human-readable string (e.g. "45s").

func (*Result) Passed

func (r *Result) Passed() int

Passed returns the number of passing expectations.

func (*Result) Summary

func (r *Result) Summary() string

Summary returns a one-line result string, e.g. "3 of 3 passed (12s)".

func (*Result) Total

func (r *Result) Total() int

Total returns the total number of expectations.

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner executes a single E2E spec end-to-end.

func New

func New(e2eFile, clusterCtx string, useCurrentCtx, keepCluster bool) (*Runner, error)

New loads an E2E spec from a YAML file and constructs a Runner.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) (*Result, error)

Run executes the full E2E test pipeline and returns a structured Result.

Jump to

Keyboard shortcuts

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