test(roles): run molecule's check step before and after converge

Every role scenario with a converge now runs check right before it (a
fresh host) and right after it (a configured host), and a script test
fails a scenario without both. pihole and pve_lxc move their second
check from after idempotence to after converge to match.

The roles that failed under --check on a fresh host get the two allowed
guards: cloudflared, docker, gitea, gitea_runner, traefik and
user_management. ufw and fail2ban preview only a host where their
package is installed, as their READMEs now say.

Closes #134

Assisted-by: Claude Code
This commit is contained in:
Defame1297 committed 2026-11-26 10:11:54 +00:00
1 parent 51b38211e7
commit cf2286b7a7
56 files changed
+202 -35

No files matched your search

@@ -395,6 +395,21 @@ class ScenarioPlatformsTest(unittest.TestCase):
seen[name] = where
self.assertNotIn("destroy", data["scenario"]["test_sequence"], path)
def test_role_scenarios_run_check_before_and_after_converge(self):
# A check-only scenario has no converge to surround, so it is not held to this.
files = sorted(REPO.glob("roles/*/molecule/*/molecule.yml"))
self.assertTrue(files)
for path in files:
sequence = yaml.safe_load(path.read_text())["scenario"]["test_sequence"]
if "converge" not in sequence:
continue
at = sequence.index("converge")
self.assertEqual(
sequence[at - 1 : at + 3],
["check", "converge", "check", "idempotence"],
path.relative_to(REPO),
)
def test_the_workflow_finds_the_containers_by_the_run_label(self):
# the sweep of earlier runs filters by the key, the cleanup of this run by key and value
self.assertEqual(