test: deduplicate the test suite #24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "test/dedup-suite"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The test suite repeated itself: every molecule.yml carried the same driver and roles-path block, a firewall-apply scenario made two claims that fit in
default, ai-stack checked the same mounts and storage tree twice, and two docker_engine scripts and five fixture inventories duplicated each other. The audit also found that the loader scenario and thetag_propagationgate passed with the loader'sinclude_roledeleted, because firewall-apply builds the chain they checked by itself.What changed
tag_propagationprove the include through zram, whose evidence only the included role writes;make testruns that scenario only through the gate.tag_selectionnow looks for the include task itself, so a lostalwaysfailsmake checkwithout podman.firewall_rendercase renders from the loader's ownservice_roles, ashandbook.ymldoes, keeping what the old loader scenario proved in passing.unsourcedscenario folds intodefault; hardening-basic'sworkstationreusesdefault's prepare; scan-share, ai-stack, unattended-upgrades and fail2ban lose repeated checks..config/molecule/config.ymlholds the driver and roles path once; the runner and the gate pass it with-c, because from a.worktrees/checkout molecule's own lookup reads the main checkout's copy.tests/fixtures/local.yml, andcheck_docker_engine.shreplaces the two docker_engine scripts.No role changes; net −368 lines.
Verification
make checkpasses at every commit.molecule syntaxandmolecule listpass for every scenario with the base config and show the podman driver; without-c, a worktree falls back to the default driver.check_mode: falsefrom docker-engine'sassert.ymland mergingdaemon.jsonover{}faildocker_engine; removingalwaysfrom the loader's include failstag_selection;ANSIBLE_PRIVATE_ROLE_VARS=Truefails the newfirewall_rendercase.make test, includingtag_propagation(no podman in the agent sandbox).Risks and follow-ups
make testis the real gate for them.refactor/dedup-roles, which relies on its loader README wording.The workstation scenario's prepare.yml was byte-identical to default's; it now runs default's through provisioner.playbooks. Its directory-mode block repeated default's word for word, though the tasks that create those directories do not depend on the profile, so only default checks them. default's existence loop, its two separate mode assertions and its directory-mode loop become one {path, mode} loop whose failure message still names the path, the mode found and the mode expected.CONTRIBUTING already listed docker_engine as one gate with two scripts, which repeated the header, the setup and the failure helper, and drove two fixture plays: one rebuilding include_role by hand from include_vars and include_tasks. check_docker_engine.sh now runs both modes through one play that takes the shipped task file as a variable, against the shared local inventory; the assert half still drops the inherited PATH so a real docker(1) cannot stand in for the stub. Checked by mutation, then reverted: removing check_mode: false from assert.yml fails the gate, and so does merging daemon.json over {} instead of the existing file.