test: run role refusal tests once, in verify.yml, not in every converge pass #420

Open
opened 2026-11-27 13:34:14 +00:00 by Claude · 0 comments
Owner

Part of #419

Problem

The system_baseline, docker, sshd and systemd_hardening scenarios keep validation-only plays (the role refuses a bad input; block/rescue/assert on the message) in converge.yml. The test sequence runs check, converge, check and idempotence, so these plays replay 4 times per platform on both platforms: 8 times per scenario. In system_baseline, 428 of the 489 tasks of one converge pass are such refusal tests.

roles/AGENTS.md "Negative tests" already asks for them in verify.yml (or a file it includes). Related: #137 (validation order and negative-test tightening across roles).

Out of scope: changing what any role validates.

Proposal

Move the refusal plays to the top of each scenario's verify.yml as plays with hosts: localhost, connection: local and check_mode: true, so they run once, need no container and cannot change a host. converge.yml keeps only the plays that converge the host.

Acceptance criteria

  • converge.yml of system_baseline, docker, sshd and systemd_hardening holds only convergence plays (review of the diff; grep -n rescue roles/*/molecule/*/converge.yml finds no refusal test in those four).
  • Every moved refusal is still rescued and asserts its expected message (review: one moved block per removed block, same fail_msg match).
  • python3 -m unittest discover -s tests/scripts passes.
  • The Molecule check passes for the four scenarios.

Assisted-by: Claude Code

Part of #419 ### Problem The `system_baseline`, `docker`, `sshd` and `systemd_hardening` scenarios keep validation-only plays (the role refuses a bad input; block/rescue/assert on the message) in `converge.yml`. The test sequence runs check, converge, check and idempotence, so these plays replay 4 times per platform on both platforms: 8 times per scenario. In `system_baseline`, 428 of the 489 tasks of one converge pass are such refusal tests. `roles/AGENTS.md` "Negative tests" already asks for them in `verify.yml` (or a file it includes). Related: #137 (validation order and negative-test tightening across roles). Out of scope: changing what any role validates. ### Proposal Move the refusal plays to the top of each scenario's `verify.yml` as plays with `hosts: localhost`, `connection: local` and `check_mode: true`, so they run once, need no container and cannot change a host. `converge.yml` keeps only the plays that converge the host. ### Acceptance criteria - [ ] `converge.yml` of `system_baseline`, `docker`, `sshd` and `systemd_hardening` holds only convergence plays (review of the diff; `grep -n rescue roles/*/molecule/*/converge.yml` finds no refusal test in those four). - [ ] Every moved refusal is still rescued and asserts its expected message (review: one moved block per removed block, same `fail_msg` match). - [ ] `python3 -m unittest discover -s tests/scripts` passes. - [ ] The Molecule check passes for the four scenarios. Assisted-by: Claude Code
Claude added the Kind/Testing
Status
Needs Triage
labels 2026-11-27 13:34:14 +00:00
Defame1297 added this to the CI velocity (emergency) milestone 2026-11-27 14:16:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#420