test: check refusals once on the controller in verify #442

Merged
Defame1297 merged 2 commits from test/refusals-in-verify into main 2026-11-27 16:32:26 +00:00
Owner

What and why

Closes #420

converge.yml is replayed by check, converge, check and idempotence on both platforms, so the validation-only plays in it ran eight times per scenario. They need no container. This moves them to the top of the same scenario's verify.yml, on localhost in check mode, so they run once, and a refusal that regressed cannot change the controller. It matches roles/AGENTS.md "Negative tests", which puts every validation's negative test in verify.yml.

  • system_baseline: 10 refusal plays (40 cases) and 5 accepted-input plays that load validate.yml.
  • docker: 5 refusal plays (11 cases). Four of them gain docker_apt_arch: amd64, the only difference from the removed blocks: the controller has no gathered facts and validate.yml derives the architecture from ansible_facts, so without it a play could be refused for the wrong reason (one play's assertion only matches docker_). Architecture derivation stays covered by converge and verify on the container.
  • sshd: 3 accepted-input plays (its refusals were already in verify).
  • systemd_hardening: the missing type, unknown type and list-instead-of-mapping refusals run on the controller. The drop-in entry that is not a mapping fails after the disable and mask tasks, so it moves to verify.yml but stays on hosts: all.

The ## Tests sections of the system_baseline and sshd READMEs say where each check now runs. The changelog fragment is trivial, since no role task or default changed.

Verified

  • ansible-playbook --syntax-check on all eight changed playbooks.
  • Each changed verify.yml run with ansible-playbook and no inventory (only the localhost plays match), ansible-core 2.19.6. Every run had rc=0, changed=0, failed=0, and every refusal was rescued: system_baseline rescued=40, docker rescued=11, systemd_hardening rescued=3, sshd ok=11 (accepted inputs only).
  • pre-commit run --files on the changed files, and the commit hooks: all pass, including ansible-lint and antsibull-changelog-lint; ansible-test sanity (pre-push) passed.
  • Reviewed by a separate agent: every removed play has a byte-identical moved copy apart from hosts/connection/check_mode/gather_facts and the docker architecture pin; no check_mode: false task that could write is reachable before validation; python3 -m unittest discover -s tests/scripts passes.

Not verified

  • Molecule (CI only): the full sequence on Ubuntu 24.04 and 26.04, including the systemd_hardening drop-in refusal that stays on the container.
  • The saved time per full run (estimated at about 10 lane-minutes, most of it in system_baseline) until the CI run shows it.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.

Assisted-by: Claude Code

## What and why Closes #420 `converge.yml` is replayed by check, converge, check and idempotence on both platforms, so the validation-only plays in it ran eight times per scenario. They need no container. This moves them to the top of the same scenario's `verify.yml`, on `localhost` in check mode, so they run once, and a refusal that regressed cannot change the controller. It matches roles/AGENTS.md "Negative tests", which puts every validation's negative test in `verify.yml`. - system_baseline: 10 refusal plays (40 cases) and 5 accepted-input plays that load `validate.yml`. - docker: 5 refusal plays (11 cases). Four of them gain `docker_apt_arch: amd64`, the only difference from the removed blocks: the controller has no gathered facts and `validate.yml` derives the architecture from `ansible_facts`, so without it a play could be refused for the wrong reason (one play's assertion only matches `docker_`). Architecture derivation stays covered by converge and verify on the container. - sshd: 3 accepted-input plays (its refusals were already in verify). - systemd_hardening: the missing type, unknown type and list-instead-of-mapping refusals run on the controller. The drop-in entry that is not a mapping fails after the disable and mask tasks, so it moves to `verify.yml` but stays on `hosts: all`. The `## Tests` sections of the system_baseline and sshd READMEs say where each check now runs. The changelog fragment is `trivial`, since no role task or default changed. ## Verified - `ansible-playbook --syntax-check` on all eight changed playbooks. - Each changed `verify.yml` run with `ansible-playbook` and no inventory (only the localhost plays match), ansible-core 2.19.6. Every run had rc=0, changed=0, failed=0, and every refusal was rescued: system_baseline rescued=40, docker rescued=11, systemd_hardening rescued=3, sshd ok=11 (accepted inputs only). - `pre-commit run --files` on the changed files, and the commit hooks: all pass, including ansible-lint and antsibull-changelog-lint; `ansible-test sanity` (pre-push) passed. - Reviewed by a separate agent: every removed play has a byte-identical moved copy apart from hosts/connection/check_mode/gather_facts and the docker architecture pin; no `check_mode: false` task that could write is reachable before validation; `python3 -m unittest discover -s tests/scripts` passes. ## Not verified - Molecule (CI only): the full sequence on Ubuntu 24.04 and 26.04, including the systemd_hardening drop-in refusal that stays on the container. - The saved time per full run (estimated at about 10 lane-minutes, most of it in system_baseline) until the CI run shows it. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code
Claude added 1 commit 2026-11-27 15:07:31 +00:00
test: check refusals once on the controller in verify
Build / build (pull_request) Successful in 1m10s
Lint / lint (pull_request) Successful in 2m54s
Molecule / molecule (pull_request) Successful in 18m44s
2e70980b44
converge.yml is replayed by check, converge, check and idempotence on
both platforms, so the validation-only plays in it ran eight times per
scenario. They need no container: move them to the top of verify.yml,
on localhost in check mode, so they run once and a regressed refusal
cannot change the controller.

Applies to the default scenarios of system_baseline, docker, sshd and
systemd_hardening. The systemd_hardening refusal of a drop-in entry
that is not a mapping comes after the disable and mask tasks, so it
moves to verify.yml but stays on the container. The README Tests
sections say where each check now runs.

Assisted-by: Claude Code:claude-opus-5-5
Defame1297 added 1 commit 2026-11-27 16:09:23 +00:00
Merge branch 'main' into test/refusals-in-verify
Build / build (pull_request) Successful in 29s
Lint / lint (pull_request) Successful in 3m20s
Molecule / molecule (pull_request) Successful in 22m24s
87738f65fd
Defame1297 approved these changes 2026-11-27 16:09:44 +00:00
Defame1297 scheduled this pull request to auto merge when all checks succeed 2026-11-27 16:09:49 +00:00
Defame1297 merged commit 810a74d8e5 into main 2026-11-27 16:32:26 +00:00
Defame1297 deleted branch test/refusals-in-verify 2026-11-27 16:32:32 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#442