Files
computer-playbook/docs/contributing/actions/testing.md
T
kevinveenbirkenbachandClaude Opus 4.7 8e293bd921 fix(compose-deploy): stop persisting runtime routing knobs into .env
Root cause of step-08 deploy failures across all 4 test-development
distros in run 26572559126: `make compose-deploy mode=reinstall
apps=web-app-dashboard INFINITO_SERVICES_DISABLED=matomo` (step 07)
made make export the cmdline var into the recipe's shell env, which
reached `runner.py` → `make setup` → `make dotenv`. The dotenv
generator's `setdefault` then baked the runtime-only value into the
on-disk `.env`. Step 08 sourced that .env, filtered `web-app-matomo`
out of its primary apps, and exited with "All primary apps disabled".

Fix:

- Drop the 7 routing knobs (apps, mode, purge, bundles, disable,
  full_cycle, variant) from `passthrough.STATIC_KEYS` and from
  `default.env`. They are per-invocation; .env is the persistent SPOT
  and must not capture them.
- Switch every consumer from `os.environ["KEY"]` strict access to
  `os.environ.get("KEY", "")` so the missing-key path stops at "no
  filter" instead of a KeyError.
- Rename the env-var surface to match the make-alias surface 1:1
  (lowercase): INFINITO_APPS → apps, INFINITO_SERVICES_DISABLED →
  disable, INFINITO_BUNDLES → bundles, INFINITO_FULL_CYCLE →
  full_cycle, INFINITO_VARIANT → variant, INFINITO_DEPLOY_MODE → mode,
  INFINITO_PURGE_ENTITIES → purge. The make alias was the user-facing
  name in every doc; routing-knob env vars now use the same name so
  the cmdline form, the recipe env-prefix, and the consumer reads
  all line up.
- Collapse the Makefile `compose-deploy` recipe to just the two
  knobs whose alias differs from the env name (`type` →
  INFINITO_DEPLOY_TYPE, `debug` → INFINITO_DEBUG). GNU Make
  auto-exports cmdline variables into the recipe's shell env, so the
  identical-name `$(if $(apps),apps="$(apps)")` lines were pure
  noise.
- Drop `disable: ${disable}` from compose.yml. The dev CLI builds
  `extra_env` per `docker exec` call and forwards `disable` via
  `-e`, so the container env never needs the value frozen at
  compose-up time.
- Update the 3 actual leak call sites
  (07/08/09_deploy_*.sh) to the make-alias form
  (`disable=matomo`, `full_cycle=true`, `variant=1`).
- Add `SIM112` to ruff's ignore set: the lowercase env names are
  the deliberate make/env parity, not a typo.

Repro before fix: `INFINITO_SERVICES_DISABLED=matomo make dotenv`
wrote `INFINITO_SERVICES_DISABLED=matomo` to `.env`. After fix:
`disable=matomo make dotenv` leaves `.env` untouched.

Tests: `make test` and `make autoformat` green (2711 tests, 8 lint
sub-targets).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 17:47:03 +02:00

5.6 KiB

Testing and Validation ✅

Use the real commands from the repository. Run them from the repository root.

This repository uses several test and validation types:

  • Lint and syntax checks catch style, formatting, and Ansible syntax problems early.
  • Unit tests verify isolated logic.
  • Integration tests verify behavior across modules and runtime boundaries.
  • External tests verify live third-party state such as public registries or services when hermetic checks are insufficient.
  • Combined validation runs the standard main verification flow.
  • Local deploy and E2E validation checks whether apps and deployment flows work in a realistic local stack.

Code Quality and Automated Checks 🔎

Use the following table to choose the right lint, syntax, unit, integration, or combined validation command for your change.

Validation Commands 🛠️

Category Command What it does When to use it
Lint make lint Runs the main lint checks for the repository. Use this when you want a broad lint pass before pushing.
Syntax make lint-ansible Runs the Ansible syntax validation for playbook.yml. Use this when you changed Ansible roles, inventories, or playbook-related files.
Lint tests make test-lint Runs the lint test suite inside the development environment. Use this when you want CI-like lint validation.
Unit tests make test-unit Runs the unit test suite. Use this when you changed Python logic or other isolated code paths.
Integration tests make test-integration Runs the integration test suite. Use this when your change affects behavior across modules or runtime boundaries.
External tests make test-external Runs opt-in tests that depend on live third-party systems such as public registries. Use this when you need live external verification. It is intentionally excluded from make test.
Combined validation make test Runs the main combined validation flow without the opt-in external suite. Use this whenever a change touches at least one file that is not .md or .rst, or before opening a Pull Request.

Local Deploy and End-to-End Checks 🚀

For the retry-loop policy, use Role Loop as the SPOT. The table below is a command reference for the supported local deployment paths.

Local Validation Commands 🏠

Use the following table when you need realistic local deployment validation or app-level end-to-end checks.

Category Command What it does When to use it
Local deploy make compose-deploy apps=web-app-nextcloud Creates the needed inventory and deploys one or more apps. Fresh deploy for a specific app set.
Local deploy make compose-deploy mode=update apps=web-app-nextcloud Reuses an existing devices.yml inventory and redeploys one or more apps quickly. Fast reuse path.
Local deploy make compose-deploy mode=update apps=web-app-nextcloud purge=true Reuses an existing devices.yml inventory, purges the entity first, and redeploys one or more apps quickly. Fast reuse path after a state reset.
Local deploy and E2E make compose-deploy mode=reinstall apps=web-app-matomo Runs a dedicated local validation flow for one or more apps against the dev stack, cycling the stack and re-initializing the inventory first. Baseline and recovery path.
Full local validation make compose-deploy Builds the broader local deployment flow across apps. Broad coverage when you explicitly need it.
Bundle deploy make compose-deploy bundles="<bundle>[,<bundle>]" Aggregates the role groups from one or more inventories/bundles/ entries into apps and runs the reinstall flow. Set full_cycle=true for the async update pass. One-shot validation of a curated app shape (e.g. education-suite).
Bundle redeploy make compose-deploy mode=update bundles="<bundle>[,<bundle>]" Same bundle resolution as the bundle deploy, but routes through the reuse path (no down/up, no entity purge). Fast iteration loop after a prior bundle deploy.
Local reset make compose-inventory-refresh Recreates the local inventory without deploying apps. Use this when your local inventory is broken or you want a clean reset.
Local cleanup make compose-system-purge Deletes local deploy artifacts and cleanup data. Use this only when you really want to remove local state.

Important:

Suite Selection 🎯

  • When exactly one test file changes inside one test family, you MAY scope the run with INFINITO_TEST_PATTERN.
  • When two or more test files change inside the same test family, you MUST run the matching suite command without INFINITO_TEST_PATTERN: make test-lint, make test-unit, make test-integration, or make test-external.
  • When a change touches multiple test families, you MUST run every affected suite.

Testing Standards 📋

For test-type-specific requirements, framework, and creation procedures see: