Declarative Unit Testing

2 min read

ork simulate runs the operator reconcile loop against a fake in-memory cluster. No Kubernetes, no kubectl, no network — results in milliseconds.


Pages

PageWhat it covers
How it worksThe fake cluster model, same reconciler, steady state detection
simulate.yamlThe recommended entry point — schema, expect:, assert mode, validation
Running simulateAll invocation forms: --cr, -f simulate.yaml, ./..., flags
Hooks and constructorsCustom binary, registry wiring, what the standard binary shows
Aggregator mode./... discovery and aggregator simulate files
LimitationsWhat simulate cannot cover and what to use instead
Running with envtestReal kube-apiserver behind --envtest — schema enforcement, watch streams, no cluster

The key property

ork simulate does not approximate what the reconciler does. It is the reconciler — the same GenericReconciler that runs in production, wired to a fake in-memory Kubernetes store. Template expressions, when: conditions, onCreate/onReconcile order, and status propagation all execute identically.

Use simulate as the fast inner loop while writing an operator. Use ork e2e as the outer gate before pushing.

ork simulateork simulate --envtestork e2e
Requires clusterNoNoYes
Runs real reconcilerYesYesYes
Real CRD schema enforcementNoYesYes
Real watch streamsNoYesYes
Tests webhooksNoNoYes
Tests external callsYesYesYes
SpeedMilliseconds~3–5sMinutes
Best forTemplate correctnessAPI-server correctnessSystem correctness

Where to go next

  • How it works — the fake cluster model, same reconciler, steady state detection
  • simulate.yaml — schema, expect:, assert mode, op-print mode, validation
  • Running simulate — all invocation forms, --dev-server, ./... discovery, flag reference

→ See also: ork simulate CLI reference | Declarative Integration Testing