Documentation home · Safety rules · Intentional behaviors
Read AGENTS.md and the intentional-behavior decisions before changing
correctness or security behavior. The controller source is under app/, Python
regressions under tests/, and the console under app/static/ui/.
Local tests
Use a Python environment with the controller dependencies installed: Kubernetes
client, pygit2, Prometheus client, Flask, requests and PyYAML. Git, OpenSSH and
OpenSSL are used by integration fixtures. Install Tini to include the container
init lifecycle regression (otherwise that test is skipped). .gitlab-ci.yml contains the Alpine
package list used in CI.
From the repository root:
./run-tests.sh
node --test tests/ui_details.test.js
The shell runner executes the Python suite only. The UI tests require Node.js and use its built-in test runner; no npm packages or browser are needed. CI runs both commands' equivalent. The TLS fixture binds a loopback server, so local socket access is required. Tests use temporary repositories and test doubles; normal unit discovery does not select a production kubeconfig.
test_git_process_lifecycle.py runs real clone/fetch/default-ref operations and
triggers automatic compaction in an isolated Linux child subreaper. It asserts
that no detached descendants remain and uses Git Trace2 events to verify fetch
maintenance and repacking complete successfully, even if repository configuration
requests background maintenance. This covers classic GC and newer geometric
repacking without requiring an intermediate git gc command. The fixture allows
retaining a base pack: multiple packs after compaction are valid, so pack count
is not a lifecycle assertion. A separate Tini test uses the
image's entrypoint flags to verify orphan reaping, failed SSH fetch cleanup and
propagation of the controller's exit status. The subreaper
test always collects its adopted children, including on regression failures.
test_purge_state.py uses the HTTP handler and real worker/ownership logic with
independent Kubernetes API doubles. It checks continuous priority protection,
receipt-matching reapplication, failed-request atomicity, retry and worker
replacement, unchanged recreation targets and no-update protection. Event-gated
concurrency cases require Purge to finish while reconciliation owns its resource
transaction and preserve a new request arriving during an active pass.
test_manifest_error_isolation.py exercises missing APIs, discovery access
errors/timeouts and client-cache errors. Each affected object retains a persisted
error while independent objects apply, pruning is blocked, and recovery on the
next run rebuilds tracking. test_reconcile_timing.py uses virtual elapsed time
to distinguish lock waiting, failed ownership refreshes, slow object reads and
stage/run duration without sleeping. Its six-object fixture checks unchanged
processing makes no workload or ownership writes.
test_ownership_concurrency.py uses an independent ConfigMap fake whose
resourceVersion check/write is atomic. Event gates hold live-object GETs,
ownership reads and ownership writes while unrelated work must finish. The
suite covers 19 simultaneous commits, unrelated-entry merges, target/alias
changes, ConfigMap replacement, bounded retries, nested recreation, alias locks
and lock lifetime. Same-resource apply/cleanup and priority regressions remain
in test_review_fixes.py, test_owner_cache.py and test_p1_regressions.py.
These tests exercise the concurrency contract without timing a real API server;
customer latency and real-cluster outage acceptance remain separate checks.
Focused regression examples:
PYTHONPATH=app:tests python3 -m unittest \
tests.test_git_ssh_keys tests.test_prune_safety tests.test_error_diagnostics \
tests.test_worker_single_flight tests.test_lint_runtime_parity \
tests.test_deployment_metrics -v
The creation-time regressions load real Kubernetes ResourceInstance objects
and verify both created and the creation-age metric for UTC, offsets,
fractional seconds and missing values. UI fixtures control request completion
order while exercising the real rendering/click handlers, including overlapping
selection and background-refresh requests.
Disposable-cluster acceptance
tests/test_install_safety.py is opt-in and skipped without explicit test
configuration. Create a disposable kind cluster named orbit-simple-<suffix>
and use its dedicated loopback kubeconfig/context:
ORBIT_TEST_KUBECONFIG=/absolute/path/to/disposable-kubeconfig \
ORBIT_TEST_CONTEXT=kind-orbit-simple-review \
PYTHONPATH=app python3 -m unittest discover -s tests -p test_install_safety.py -v
The fixture installs the OD CRD, not the running controller Deployment. It uses real API operations to check apply/prune, ownership, flags, recreation, DELETE races, PVC metadata updates and target-only Namespace protection. This does not replace supported-version, outage, crash-gap or performance acceptance.
Documentation and backlog maintenance
Keep the root README concise and put detailed topics in docs/, linked from
its README. Review local links and example syntax after documentation changes.
Record unfinished work in TODO.md, using High, Medium, Low or
Parked priority; remove completed work rather than retaining checked entries.
The embedded registry's separate backlog is
parked. Source-registry client issues used by normal reconciliation remain in
the main TODO.
