Files
computer-playbook/docs/contributing/actions/testing.md
T
kevinveenbirkenbachandClaude Opus 4.7 9a578952c3 feat(env): SPOT env-pipeline + INFINITO_* namespace
Replace 8 bash env modules with a single Python generator
(cli.meta.env) that materialises env/static.env + runtime context
into a gitignored .env. Each variable lives in its own handler
under utils/env/handlers/; defaults carry inline one-line `# ...`
comments.

Rename to the INFINITO_* schema:
- workflow inputs: APPS, SERVICES_DISABLED, CMD, DEBUG, WHITELIST,
  BUNDLES, FULL_CYCLE, VARIANT, RUN_FLAGS, LIMIT_HOST, PARALLEL
- inventory: INVENTORY_DIR / INVENTORY_FILE / HOST_VARS_FILE,
  PW_FILE -> INVENTORY_PASSWORD_FILE
- venv: VENV_BASE / VENV_FALLBACK / VENV_NAME
- new SPOT defaults: COMPILE_SILENCE, CONTAINER_NO_CA,
  WAIT_HEALTH_TIMEOUT_S, PACKAGE_CACHE_FRONTEND_INIT_IMAGE,
  promoted IMAGE_TAG from GHA-only to general passthrough

compose.yml hardening:
- inline \${VAR:-default} removed; strict \${VAR:?...} everywhere
- new integration lint blocks regressions

Tooling:
- scripts/install/all.sh owns the stamp-file install logic
  (Makefile target delegates)
- scripts/meta/env/load.sh is the single shell entry point;
  8 bash modules deleted
- new shell lint: no INFINITO_* defaults outside env/static.env

Tests:
- 93 new unit tests for utils/env/{builder,parser,runtime,writer}
- restructure tests/lint into repository/ (file-content rules) vs
  filesystem/{shell,python,env}/ (filesystem-shape rules)
- drift + smoke integration tests against the generator

Docs:
- variables.md is now a pointer; per-variable docs live next to
  the key in env/static.env / env/ci.env
- compose.yml.md drops the Default column

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 20:40:34 +02:00

73 lines
5.6 KiB
Markdown

# 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](../../agents/action/iteration/role.md) 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 deploy-fresh-kept-apps INFINITO_APPS=web-app-nextcloud` | Creates the needed inventory and deploys one or more apps. | Fresh deploy for a specific app set. |
| Local deploy | `make deploy-reuse-kept-apps INFINITO_APPS=web-app-nextcloud` | Reuses an existing `devices.yml` inventory and redeploys one or more apps quickly. | Fast reuse path. |
| Local deploy | `make deploy-reuse-purged-apps INFINITO_APPS=web-app-nextcloud` | 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 deploy-fresh-purged-apps INFINITO_APPS=web-app-matomo` | Runs a dedicated local validation flow for one or more apps against the dev stack, creating and re-initializing the inventory first. | Baseline and recovery path. |
| Full local validation | `make deploy-fresh-kept-all` | Builds the broader local deployment flow across apps. | Broad coverage when you explicitly need it. |
| Bundle deploy | `INFINITO_BUNDLES="<bundle>[,<bundle>]" make deploy-bundles` | Aggregates the role groups from one or more [inventories/bundles/](../../../inventories/bundles/) entries into `INFINITO_APPS` and runs the fresh-purged deploy. Set `INFINITO_FULL_CYCLE=true` for the async update pass. | One-shot validation of a curated app shape (e.g. `education-suite`). |
| Bundle redeploy | `INFINITO_BUNDLES="<bundle>[,<bundle>]" make redeploy-bundles` | Same bundle resolution as `deploy-bundles`, but routes through the reuse-kept path (no down/up, no entity purge). | Fast iteration loop after a prior `deploy-bundles` run. |
| Local reset | `make container-refresh-inventory` | Recreates the local inventory without deploying apps. | Use this when your local inventory is broken or you want a clean reset. |
| Local cleanup | `make container-purge-system` | Deletes local deploy artifacts and cleanup data. | Use this only when you really want to remove local state. |
Important:
- Some local deploy commands are destructive.
- Read [reset/README.md](../../../scripts/tests/deploy/local/reset/README.md), [purge/README.md](../../../scripts/tests/deploy/local/purge/README.md), or [exec/README.md](../../../scripts/tests/deploy/local/exec/README.md) before using the matching helper.
- For act-based workflow checks, see [Act Workflow Checks](../tools/act.md).
- After a successful local deploy, run `make trust-ca` and restart your browser.
## 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:
- [Unit Tests](testing/unit.md)
- [Integration Tests](testing/integration.md)
- [External Tests](testing/external.md)
- [Playwright Tests](testing/playwright.md)