Files
computer-playbook/tests/lint/ansible/shell/README.md
kevinveenbirkenbach a3402eac5b test(lint): group ansible lints into per-concern subdirs + add dotted-path test
Restructures tests/lint/ansible/ into five concern-keyed subdirectories
(jinja/, modules/, services/, shell/, sql/) plus the pre-existing roles/
and variables/. Each new subdir ships its own __init__.py exporting
PROJECT_ROOT and a scope-focused README.md following the project's
documentation conventions (RFC 2119 keywords, emoji-after-headline,
one-sentence-per-line, no historical context).

12 existing tests move into their concern bucket via git mv so history
follows the file. Adds tests/lint/ansible/variables/test_dotted_path_keys_exist.py
which catches the bug class where a Jinja dotted path's head resolves
via group_vars/all/ or the consuming role's own vars/defaults but a
deeper segment does not exist as a key in the dict tree (e.g. the
previous `LDAP.SERVER.REACH_DOMAIN` typo in web-app-odoo).

Touches three external references so cross-links keep resolving:
- docs/contributing/actions/testing/suppression.md (run-once, shared)
- roles/sys-svc-compose/tasks/utils/network/README.md (network-via-util)
- tests/lint/ansible/sql/test_no_inline_multiline_sql.py (self-path exclude)
2026-05-14 17:12:56 +02:00

13 lines
1018 B
Markdown

# Shell Pipeline Lints 🐚
Lint tests that enforce safe shell-pipeline patterns inside Ansible `command:` and `shell:` tasks.
Each test catches a Bash default that hides upstream failures, especially when the failure surfaces only on the second or third command of a pipeline.
Tests in this directory MUST only cover shell-invocation correctness inside Ansible tasks.
- `test_no_sh_lc_pipefail.py` requires that every `sh -lc '...'` invocation containing a `|` pipeline starts with `set -o pipefail`, so failures mid-pipeline propagate.
- `test_no_sh_pipefail_in_ansible_tasks.py` requires that Ansible `shell:` tasks stay on Bash and use Bash's `set -o pipefail` form, not the POSIX-`sh` workaround.
- `test_sed_escape.py` requires that any Jinja-templated replacement passed to `sed` flows through the `sed_escape` filter so substitutions with regex metacharacters land literally.
For framework, directory layout, and `make test-lint` usage see [lint.md](../../../../docs/contributing/actions/testing/lint.md).