Author SHA1 Message Date
Defame1297 92cf7257d4 test(molecule): wrap the runner stub under the sanity line limit
Build / build (pull_request) Successful in 30s
Lint / lint (pull_request) Successful in 3m51s
Molecule / molecule (pull_request) Successful in 34m54s
Part of #432

Assisted-by: Claude Code
2026-11-28 08:48:29 +00:00
Defame1297 e34a0eb2e0 test(molecule): derive the order test from the duration list
Part of #432. The start-order test now reads its scenarios and their seconds
from the run script's list, so a refreshed list does not break it; the
empty-lanes test only asserts the value is accepted, and the script's header
and duration-list comments are rewrapped and say the list is keyed by
scenario directory.

Assisted-by: Claude Code
2026-11-28 08:45:05 +00:00
Defame1297 ef840c8952 ci(molecule): start the longest scenarios first and pass the lane count in
Part of #432. A long scenario started late sets the end of a full run, so
run_molecule_scenarios.sh now starts scenarios by the durations of the last
full run, longest first, with an unlisted scenario first; the log groups keep
the selection order. A workflow_dispatch input `lanes` reaches the script as
MOLECULE_LANES, so full runs with different lane counts can be compared; an
empty value keeps the default of 4.

The shared molecule config enables ansible.posix.profile_tasks (summary only)
and ansible.posix.timer, so each scenario's log shows where its time goes.

Assisted-by: Claude Code
2026-11-28 08:36:20 +00:00
Defame1297 a2ab13a6e1 Merge pull request 'feat(docker): pin the Docker apt key by checksum' (#454) from feat/448-docker-keyring-checksum into main
Reviewed-on: #454
2026-11-28 08:22:23 +00:00
Defame1297 a185a301db docs(docker): say the keyring checksum follows an overridden key URL
Build / build (pull_request) Successful in 28s
Lint / lint (pull_request) Successful in 3m37s
Molecule / molecule (pull_request) Successful in 7m29s
Set docker_keyring_checksum together with docker_gpg_url, and state that
the checksum is the hex digest without the sha256: prefix.

Assisted-by: Claude Code
2026-11-27 22:25:00 +00:00
Defame1297 c7c38c6bc0 feat(docker): pin the Docker apt key by checksum
The key that signs the Docker repository was trusted as whatever the URL served. It is now checked
against a pinned sha256, so a changed key stops the install until a person has verified it.

Assisted-by: Claude Code
2026-11-27 22:09:56 +00:00
14 changed files with 216 additions and 11 deletions

No files matched your search

+6
View File
@@ -11,3 +11,9 @@ provisioner:
defaults:
# Gather each host's facts once per playbook run, not in every play.
gathering: smart
# Per-task timings, to see what a scenario's time goes to; ansible.posix is in the ci image
# and in requirements.yml, so the controller always has these callbacks.
callbacks_enabled: ansible.posix.profile_tasks, ansible.posix.timer
callback_profile_tasks:
summary_only: true
task_output_limit: 20
+8 -3
View File
@@ -110,9 +110,14 @@ issue.
concurrency group of its own.** Runs may overlap on the runner's Docker daemon: every container
is named and labelled by its run (`KAMINO_RUN_ID`). The job first removes labelled containers
older than its timeout, which a cancelled run left, and finally its own. The scenarios of one
run overlap (`scripts/run_molecule_scenarios.sh`, `MOLECULE_LANES` at a time), so no two
scenarios may share a platform name. *Why:* a cancelled run is killed before it can remove its
instances, and a younger container may belong to a run still going. *Held:* review; control:
run overlap (`scripts/run_molecule_scenarios.sh`, `MOLECULE_LANES` at a time, 4 unless a manual
dispatch sets its `lanes` input), so no two scenarios may share a platform name. They start
longest first by the script's list of last full-run times, an unlisted one first; the logs stay
in selection order. *Why:* a cancelled run is killed before it can remove its instances, a
younger container may belong to a run still going, and a long scenario started late sets the
end of the run. *Held:* review; control: the start order by
`test_the_longest_scenarios_start_first` and the input by `LanesInputTest`, both in
`tests/scripts/test_run_molecule_scenarios.py`; control:
the names and labels by the test the `test_sequence` rule below names, and the sweep's age bound
equal to the job timeout by `test_the_sweep_spares_containers_younger_than_the_job_timeout` in
`tests/scripts/test_run_molecule_scenarios.py`.
+10 -2
View File
@@ -24,7 +24,13 @@ on: # yamllint disable-line rule:truthy
# drift in the others (a package mirror) would otherwise go unseen. After Renovate's 03:17 run.
schedule:
- cron: "43 4 * * *"
workflow_dispatch: {}
workflow_dispatch:
inputs:
lanes:
description: Scenarios run at a time (empty for the default of run_molecule_scenarios.sh)
required: false
type: string
default: ""
permissions:
contents: read
@@ -123,6 +129,8 @@ jobs:
EVENT_NAME: ${{ github.event_name }}
# The workflow only runs for pull requests to main; lint.yml uses the same constant.
BASE_REF: origin/main
# Empty outside a dispatch, which the run script reads as its default.
MOLECULE_LANES: ${{ inputs.lanes }}
run: |
# The selector comes from the base branch, so a pull request cannot edit the rules it is
# judged by (lint.yml does the same for check_bot_pr_diff.py); the first pull request that
@@ -154,7 +162,7 @@ jobs:
-v /var/run/docker.sock:/var/run/docker.sock -v "$docker_cli:/usr/local/bin/docker:ro" \
-v "$ac_root:$ac_root" -v "$ac_root/passwd:/etc/passwd:ro" -w "$PWD" \
-e "AC_ROOT=$ac_root" -e "HOME=$ac_root/home" -e "USER=$(id -un)" \
-e MOLECULE_IMAGE -e MOLECULE_IMAGE_2604 -e KAMINO_RUN_ID \
-e MOLECULE_IMAGE -e MOLECULE_IMAGE_2604 -e KAMINO_RUN_ID -e MOLECULE_LANES \
"$CI_IMAGE" scripts/run_molecule_in_ci_image.sh <<< "$selected"
# A cancelled run can leave its containers running when the docker client is killed.
@@ -0,0 +1,6 @@
---
minor_changes:
- >-
docker - New input ``docker_keyring_checksum``: the Docker APT key is verified against a pinned
sha256, and a changed key fails the install until a person has checked it and updated the hash.
Set ``docker_keyring_checksum`` too when ``docker_gpg_url`` is overridden.
+4 -2
View File
@@ -27,6 +27,7 @@ The role targets Ubuntu hosts only: it installs from Docker's Ubuntu repository,
| `docker_keyring_path` | `/etc/apt/keyrings/docker.asc` | no | Repository key location. |
| `docker_apt_list_path` | `/etc/apt/sources.list.d/docker.list` | no | APT source file. |
| `docker_gpg_url` | `https://download.docker.com/linux/ubuntu/gpg` | no | Key URL. |
| `docker_keyring_checksum` | sha256 of the current Docker key | no | Expected sha256 (hex, no `sha256:` prefix) of the key at `docker_gpg_url`; set it too when `docker_gpg_url` is overridden; a mismatch fails the download, so a changed key stops the install until this is updated. |
| `docker_repo_base_url` | `https://download.docker.com/linux/ubuntu` | no | Repository base URL. |
| `docker_apt_arch` | derived from the host | no | Architecture in the APT source. Empty derives it (`x86_64` gives `amd64`, `aarch64` gives `arm64`); another architecture fails until this is set. A value set here is always used; lowercase letters and digits only. |
| `docker_start_missed` | `false` | no | Install a boot unit that starts the containers Docker skipped after a reboot (see [Boot and shutdown units](#boot-and-shutdown-units)). |
@@ -86,17 +87,18 @@ With any of `docker_daemon_options`, `docker_live_restore`, `docker_log_driver`,
## Tests
`molecule/default` runs in CI only (`.gitea/workflows/molecule.yml`, no local runner), on two platforms: `${MOLECULE_IMAGE}` (Ubuntu 24.04) and `${MOLECULE_IMAGE_2604}` (Ubuntu 26.04). A real Docker Engine cannot run there: `dockerd` needs the bridge, iptables rules and a delegated cgroup, and the container has no privileged mode. So the scenario builds a local APT repository, signs it with a throwaway key, and points the role at it with `docker_gpg_url` and `docker_repo_base_url`. The repository holds empty stand-ins for `docker-ce`, `docker-ce-cli` and `containerd.io`. The stand-in `docker-ce` ships a stub `docker.service` (`sleep infinity`) and creates the `docker` group, as the real package does. It runs `check` before the converge (on a fresh host) and after it (on the configured host).
`molecule/default` runs in CI only (`.gitea/workflows/molecule.yml`, no local runner), on two platforms: `${MOLECULE_IMAGE}` (Ubuntu 24.04) and `${MOLECULE_IMAGE_2604}` (Ubuntu 26.04). A real Docker Engine cannot run there: `dockerd` needs the bridge, iptables rules and a delegated cgroup, and the container has no privileged mode. So the scenario builds a local APT repository, signs it with a throwaway key, and points the role at it with `docker_gpg_url`, `docker_keyring_checksum` (the throwaway key's hash) and `docker_repo_base_url`. The repository holds empty stand-ins for `docker-ce`, `docker-ce-cli` and `containerd.io`. The stand-in `docker-ce` ships a stub `docker.service` (`sleep infinity`) and creates the `docker` group, as the real package does. It runs `check` before the converge (on a fresh host) and after it (on the configured host).
What it shows, with the role's tasks running unchanged:
- The key is fetched, stored at `docker_keyring_path` with mode `0644`, and apt really verifies the repository against it (an unsigned or wrongly signed repository would leave no install candidate).
- The key is fetched, checked against `docker_keyring_checksum`, stored at `docker_keyring_path` with mode `0644`, and apt really verifies the repository against it (an unsigned or wrongly signed repository would leave no install candidate).
- The source line has the architecture, the `signed-by` keyring and `ansible_facts['distribution_release']`.
- The packages are installed from that repository, the unit is enabled and active, and `docker_users` join `docker_group`.
- `docker_remove` with `docker_remove_data` removes the source line, the keyring, the packages, the unit and `/var/lib/docker`.
- Both units are installed, enabled, ordered against `docker.service` as stated, the shutdown unit is active, a unit is removed when its input is `false`, and `docker_remove` removes both.
- With the daemon inputs set, `/etc/docker/daemon.json` is valid JSON with exactly the expected keys, mode `0644` and root-owned. A change with `docker_daemon_restart: false` leaves dockerd running (its start time is unchanged); with `true` it restarts it. A key set both in `docker_daemon_options` and by a dedicated input, and a bad log size, driver or file count, are refused before any change.
- The argument check refuses a mapping for `docker_users`, a non-boolean `docker_remove` and a `docker_stop_at_shutdown_timeout` of 0.
- A key whose hash does not match `docker_keyring_checksum` fails the key download.
- A second run changes nothing (molecule's idempotence check).
What it does not show: what the units do at a real boot or shutdown (the container has no dockerd, no NFS shares and no reboot; the selection logic of `docker-start-missed` is unit-tested in `tests/scripts/test_docker_files.py`), that the upstream repository and key at `download.docker.com` are reachable and valid, that the real packages install, that `dockerd` starts, anything about container networking or iptables, the `docker_update` path (`tasks/update.yml`), and removal without `docker_remove_data` (the removal stops the unit first, so it can run only once per install). It needs the Ubuntu mirrors, for the `curl` the role installs. These gaps are a known residual risk of the role.
+4
View File
@@ -11,6 +11,10 @@ docker_packages:
docker_keyring_path: /etc/apt/keyrings/docker.asc
docker_apt_list_path: /etc/apt/sources.list.d/docker.list
docker_gpg_url: https://download.docker.com/linux/ubuntu/gpg
# sha256 of Docker's package signing key (9DC858229FC7DD38854AE2D88D81803C0EBFCD88), as the ASCII-armored file
# docker_gpg_url serves. Static on purpose: a rotated or re-armored key fails the install until a person has checked the
# new one and updated this hash.
docker_keyring_checksum: "1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570"
docker_repo_base_url: https://download.docker.com/linux/ubuntu
# Architecture written into the APT source. Empty (the default) derives it from the host: x86_64 gives amd64, aarch64 gives arm64, any
+8
View File
@@ -49,6 +49,14 @@ argument_specs:
default: https://download.docker.com/linux/ubuntu/gpg
description:
- URL of the repository signing key.
docker_keyring_checksum:
type: str
default: 1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570
description:
- >-
sha256 of the key at C(docker_gpg_url), as the hex digest without the C(sha256:) prefix. The download fails
on a mismatch, so a rotated or re-armored upstream key stops the install until the new key is checked and
the hash updated. Set C(docker_keyring_checksum) too when C(docker_gpg_url) is overridden.
docker_repo_base_url:
type: str
default: https://download.docker.com/linux/ubuntu
@@ -7,6 +7,8 @@
hosts: all
vars:
docker_gpg_url: file:///srv/docker-stub-repo/docker.asc
# The stand-in key is generated per run, so its hash is read here rather than pinned.
docker_keyring_checksum: "{{ docker_stub_key.stat.checksum }}"
docker_repo_base_url: file:///srv/docker-stub-repo
docker_users: [moleculeuser]
docker_start_missed: true
@@ -18,5 +20,11 @@
docker_log_max_file: "3"
docker_daemon_options:
max-concurrent-downloads: 3
pre_tasks:
- name: Stat the stand-in repository key
ansible.builtin.stat:
path: /srv/docker-stub-repo/docker.asc
checksum_algorithm: sha256
register: docker_stub_key
roles:
- role: mortis.kamino.docker
@@ -0,0 +1,27 @@
---
# The zeroed hash matches no file, so the key task must be the one that fails.
- name: Run the role with a checksum the stand-in key does not have
block:
- name: Include the role
ansible.builtin.include_role:
name: mortis.kamino.docker
vars:
docker_gpg_url: file:///srv/docker-stub-repo/docker.asc
docker_repo_base_url: file:///srv/docker-stub-repo
docker_keyring_path: /tmp/docker-refused-key.asc
docker_keyring_checksum: "{{ '0' * 64 }}"
- name: Fail when the wrong key was accepted
ansible.builtin.fail:
msg: MOLECULE-ACCEPTED
rescue:
- name: The key download stopped the play
ansible.builtin.assert:
that:
- ansible_failed_task.name == 'Install Docker APT GPG key'
- "'did not match' in ansible_failed_result.msg | default('')"
quiet: true
always:
- name: Remove the refused key path
ansible.builtin.file:
path: /tmp/docker-refused-key.asc
state: absent
+22
View File
@@ -302,12 +302,19 @@
hosts: all
vars:
docker_gpg_url: file:///srv/docker-stub-repo/docker.asc
docker_keyring_checksum: "{{ docker_stub_key.stat.checksum }}"
docker_repo_base_url: file:///srv/docker-stub-repo
docker_users: [moleculeuser]
docker_start_missed: false
docker_stop_at_shutdown: true
docker_stop_at_shutdown_timeout: 20
tasks:
- name: Stat the stand-in repository key
ansible.builtin.stat:
path: /srv/docker-stub-repo/docker.asc
checksum_algorithm: sha256
register: docker_stub_key
- name: Apply the role with the boot unit off
ansible.builtin.include_role:
name: mortis.kamino.docker
@@ -368,6 +375,7 @@
hosts: all
vars:
docker_gpg_url: file:///srv/docker-stub-repo/docker.asc
docker_keyring_checksum: "{{ docker_stub_key.stat.checksum }}"
docker_repo_base_url: file:///srv/docker-stub-repo
docker_users: [moleculeuser]
docker_start_missed: true
@@ -378,6 +386,12 @@
docker_log_max_file: "3"
docker_live_restore: true
tasks:
- name: Stat the stand-in repository key
ansible.builtin.stat:
path: /srv/docker-stub-repo/docker.asc
checksum_algorithm: sha256
register: docker_stub_key
- name: Read the start time of the service
ansible.builtin.command: systemctl show -p ActiveEnterTimestampMonotonic docker.service # noqa: command-instead-of-module
register: docker_verify_before
@@ -420,6 +434,14 @@
- (docker_verify_daemon_after.content | b64decode | from_json)['max-concurrent-downloads'] == 6
quiet: true
# A key that does not match docker_keyring_checksum fails at the key download, so the source line and packages are untouched. It goes to a separate path, so
# the installed key stays for the removal below.
- name: A key that does not match the pinned checksum is refused
hosts: all
tasks:
- name: Apply the role with a wrong checksum
ansible.builtin.include_tasks: tasks/refuse_checksum.yml
# docker_remove_data is set, so this also covers the destructive path: the packages are
# purged and /var/lib/docker, seeded in prepare.yml, is deleted. The removal stops the unit
# before the package takes it away, so it can only run once; a second run would fail on the
+1
View File
@@ -23,6 +23,7 @@
ansible.builtin.get_url:
url: "{{ docker_gpg_url }}"
dest: "{{ docker_keyring_path }}"
checksum: "sha256:{{ docker_keyring_checksum }}"
mode: "0644"
tags: [docker, install]
+35 -3
View File
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
# The Molecule workflow's "Run the scenarios" step: `molecule test` for each scenario directory on
# stdin, MOLECULE_LANES (default 4) at a time, each with its own log and ANSIBLE_HOME under
# <work-dir>/<n>/ (no collection is installed there: .config/molecule/config.yml sets prerun false).
# stdin, MOLECULE_LANES (default 4, also when empty) at a time, longest first, each with its own
# log and ANSIBLE_HOME under <work-dir>/<n>/ (no collection is installed there:
# .config/molecule/config.yml sets prerun false).
# Exit 1 on a failure.
#
# scripts/run_molecule_scenarios.sh <work-dir> < scenario-dirs
@@ -77,6 +78,37 @@ while IFS= read -r dir; do
done
mkdir -p "$work"
# Seconds each scenario took in the last full run, so the longest start first and none started
# late sets the end of the run. Keyed by scenario directory, not label: refresh from a full run's
# `finished <label>: exit 0 after S s` lines, each label mapped back to its directory. A scenario
# missing here is assumed long and starts first.
declare -A last_seconds=(
[roles/system_baseline/molecule/default]=1127
[roles/ufw/molecule/default]=907
[roles/traefik/molecule/default]=886
[roles/gitea_runner/molecule/default]=762
[roles/cloudflared/molecule/default]=673
[roles/docker/molecule/default]=612
[roles/tailscale/molecule/default]=509
[roles/fail2ban/molecule/default]=337
[roles/systemd_hardening/molecule/default]=335
[roles/gitea/molecule/default]=301
[roles/user_management/molecule/default]=270
[roles/_binary_update/molecule/default]=248
[roles/pihole/molecule/default]=228
[roles/sshd/molecule/default]=163
[roles/pve_lxc/molecule/default]=157
[roles/network_interfaces/molecule/default]=129
[roles/_binary_update/molecule/check_mode]=81
[extensions/molecule/image-smoke]=47
[extensions/molecule/image-smoke-2604]=46
)
# The indices of dirs in start order; ties keep the selection order (a stable sort).
mapfile -t start_order < <(
for n in "${!dirs[@]}"; do printf '%s %s\n' "${last_seconds[${dirs[$n]}]:-999999}" "$n"; done |
sort -s -k1,1nr | cut -d' ' -f2
)
# A cancelled job must not leave lanes behind that recreate containers after the next run's
# cleanup. A signal to this script stops each lane's tree so it cannot fork, then terminates it,
# with the whole group of any descendant that leads one: ansible's workers detach into their own.
@@ -110,7 +142,7 @@ trap 'stop_lanes 143' TERM
trap 'stop_lanes 130' INT
trap 'stop_lanes 129' HUP
for n in "${!dirs[@]}"; do
for n in "${start_order[@]}"; do
while [ "$(jobs -rp | wc -l)" -ge "$lanes" ]; do wait -n || true; done
run_one "$n" "${dirs[$n]}" </dev/null &
done
@@ -42,7 +42,9 @@ exit 0
# The scenario runner: records its arguments, paths and stdin.
RUNNER_STUB = """#!/usr/bin/env bash
echo "runner args=$* path=$PATH acp=$ANSIBLE_COLLECTIONS_PATH inject=${ANSIBLE_INJECT_FACT_VARS-unset} stdin=[$(cat | tr '\\n' ' ')]" >> "$STUB_LOG"
echo "runner args=$* path=$PATH acp=$ANSIBLE_COLLECTIONS_PATH" \\
"inject=${ANSIBLE_INJECT_FACT_VARS-unset} lanes=${MOLECULE_LANES-unset}" \\
"stdin=[$(cat | tr '\\n' ' ')]" >> "$STUB_LOG"
"""
@@ -161,6 +163,12 @@ class RunMoleculeInCiImageTest(unittest.TestCase):
runner,
)
def test_the_lane_count_reaches_the_scenario_runner(self):
result = self.run_script(MOLECULE_LANES="3")
self.assertEqual(result.returncode, 0, result.stderr)
(runner,) = self.calls("runner")
self.assertIn(" lanes=3 ", runner)
def test_the_load_check_sees_the_selection_and_the_final_path(self):
selection = "roles/alpha/molecule/default\nextensions/molecule/image-smoke\n"
result = self.run_script(selection, STUB_FAIL_sha256sum="1")
@@ -283,6 +283,46 @@ class RunMoleculeScenariosTest(unittest.TestCase):
self.assertEqual(proc.returncode, 1)
self.assertIn("::error::ran 1 of 2 selected scenarios", proc.stdout)
@unittest.skipUnless(HAS_MOLECULE, NEEDS_MOLECULE)
def test_the_longest_scenarios_start_first(self):
# an unlisted scenario counts as longest; the groups keep the selection order
seconds = listed_seconds()
roles = [d for d in seconds if d.startswith("roles/")]
shortest, longest = min(roles, key=seconds.get), max(roles, key=seconds.get)
for scenario in (shortest, longest):
d = self.root / scenario
d.mkdir(parents=True)
name = f"{RUN_ID}-{scenario.replace('/', '-')}"
platforms = [{"name": name, "image": "${MOLECULE_IMAGE}"}]
(d / "molecule.yml").write_text(yaml.safe_dump({"platforms": platforms}))
smoke = "extensions/molecule/image-smoke"
order = [smoke, shortest, "roles/alpha/molecule/default", longest]
listed = sorted((smoke, shortest, longest), key=seconds.get, reverse=True)
proc = self.run_script(order, MOLECULE_LANES="1")
self.assertEqual(proc.returncode, 0, proc.stdout + proc.stderr)
spans = self.events()
self.assertEqual(
sorted(spans, key=lambda label: spans[label][0]),
[label(d) for d in ["roles/alpha/molecule/default", *listed]],
)
groups = re.findall(
r"^::group::molecule test: (\S+) ", proc.stdout, re.MULTILINE
)
self.assertEqual(groups, [label(d) for d in order])
def test_the_duration_list_names_existing_scenarios(self):
# a renamed scenario would otherwise drop out of the list unnoticed
listed = listed_seconds()
self.assertTrue(listed)
for scenario in listed:
self.assertTrue((REPO / scenario / "molecule.yml").is_file(), scenario)
@unittest.skipUnless(HAS_MOLECULE, NEEDS_MOLECULE)
def test_empty_lanes_are_accepted(self):
# the workflow passes an empty value outside a manual dispatch
proc = self.run_script(list(PLATFORMS), MOLECULE_LANES="")
self.assertEqual(proc.returncode, 0, proc.stdout + proc.stderr)
def test_lanes_must_be_a_positive_integer(self):
for lanes in ("0", "-1", "two", "04"):
proc = self.run_script(list(PLATFORMS), MOLECULE_LANES=lanes)
@@ -349,6 +389,20 @@ class RunMoleculeScenariosTest(unittest.TestCase):
self.assertEqual(self.log.read_text(), "")
def listed_seconds():
"""{scenario directory: seconds} from the run script's duration list."""
pairs = re.findall(r"^ \[([^]]+)\]=(\d+)$", SCRIPT.read_text(), re.MULTILINE)
return {d: int(s) for d, s in pairs}
def label(scenario):
"""The run script's label of a scenario directory, as its log groups print it."""
if scenario.startswith("extensions/"):
return scenario.rsplit("/", 1)[1]
parts = scenario.split("/")
return f"{parts[1]}/{parts[3]}"
def alive(pid):
"""Whether pid is a running process, not gone or a zombie."""
try:
@@ -416,6 +470,20 @@ class ScenarioPlatformsTest(unittest.TestCase):
)
class LanesInputTest(unittest.TestCase):
"""A manual dispatch can set the lane count of the run script inside the run container."""
def test_the_dispatch_input_reaches_the_run_container(self):
workflow = yaml.safe_load(WORKFLOW.read_text())
# yaml reads the `on:` key as True
lanes = workflow[True]["workflow_dispatch"]["inputs"]["lanes"]
self.assertEqual((lanes["type"], lanes["default"]), ("string", ""))
steps = workflow["jobs"]["molecule"]["steps"]
step = next(s for s in steps if s.get("name") == "Run the scenarios")
self.assertEqual(step["env"]["MOLECULE_LANES"], "${{ inputs.lanes }}")
self.assertRegex(step["run"], r"docker run [^<]*-e MOLECULE_LANES\b")
class ScenarioSequenceTest(unittest.TestCase):
"""A role scenario previews the fresh host and the configured host with molecule's check step."""