Share the Molecule scaffolding and add just molecule

Three things that would not have scaled to 70 roles:

- The Python and Ansible dependency pins were about to be copied into every
  role. They now live once in molecule-shared/, which scenarios reference
  relatively, so they cannot drift apart.
- The helper container images used for probing were hardcoded inline. They
  are pinned once in molecule-shared/vars.yml, carry `# renovate:`
  annotations, and a custom manager in .github/renovate.json keeps them
  current - verified with a local Renovate dry run, which offers
  curl 8.11.1 -> 8.21.0 and python 3.13 -> 3.14-alpine. Seventy invisible
  hardcodes is the blindness class we have been removing elsewhere.
- Running a scenario meant knowing the venv and cd incantation. `just
  molecule <role>` does it, and with no argument lists the roles that have
  a scenario.

Molecule is deliberately not wired into prek: a run takes minutes, pulls
images and needs Docker, which is fine on request and not fine per commit.

docs/molecule-testing.md covers how to run and write these, including the
four things a role here needs that a standalone role does not. AGENTS.md
points at it rather than carrying the detail.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Slavi Pantaleev
2026-08-27 18:02:53 +03:00
co-authored by Claude Opus 5
parent ebe13bc360
commit 9370fdf4b4
15 changed files with 276 additions and 74 deletions
@@ -6,6 +6,8 @@
- name: Prepare matrix-alertmanager-receiver Molecule tests
hosts: all
become: true
vars_files:
- "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/../../../molecule-shared/vars.yml"
gather_facts: true
tasks:
- name: Ensure apt cache is updated
@@ -116,7 +118,7 @@
- --network={{ matrix_alertmanager_receiver_container_network }}
- --network-alias=matrix.molecule.local
- --volume=/root/matrix-homeserver-stub.py:/stub.py:ro
- docker.io/library/python:3.13-alpine
- "{{ molecule_shared_image_python }}"
- python3
- /stub.py
register: matrix_alertmanager_receiver_molecule_stub