Runs on noble and resolute without the real Pi-hole: the clone target is a local git repository whose installer is a stub that logs its arguments and creates the database file. Covers a check run before the converge and after idempotence, the merge, the rendered pihole.toml (upstreams, interface, hashed password, owner and mode), the system user, the installer sequence (install once, then reconfigure from the handler) and a negative test for every validation: no Ubuntu facts, a missing pihole_web_password, an unset interface, empty upstreams, a non-string and a placeholder password. No pihole-FTL service runs, so the loaded configuration is not verified. Assisted-by: Claude Code:claude-opus-5-5
80 lines
2.4 KiB
YAML
80 lines
2.4 KiB
YAML
---
|
|
# Runs on the repository's own runner (label kamino-molecule), on both declared platforms:
|
|
# molecule-ubuntu2404 (MOLECULE_IMAGE) and molecule-ubuntu2604 (MOLECULE_IMAGE_2604), the pins in
|
|
# .gitea/workflows/molecule.yml. Needs outbound network for the apt packages. The upstream
|
|
# Pi-hole repository is replaced by a local stub whose installer only logs its arguments
|
|
# (prepare.yml), so the scenario tests the role's own logic, not Pi-hole itself.
|
|
# The containers run systemd as PID 1 with a writable cgroup; no privileged mode.
|
|
driver:
|
|
name: docker
|
|
platforms:
|
|
- name: ${KAMINO_RUN_ID:-local}-pihole-noble
|
|
labels:
|
|
net.rkdr.mortis.molecule-run: "${KAMINO_RUN_ID:-local}"
|
|
image: ${MOLECULE_IMAGE}
|
|
pre_build_image: true
|
|
pull: true
|
|
command: /sbin/init
|
|
cgroupns_mode: host
|
|
volumes:
|
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
|
tmpfs:
|
|
- /run
|
|
- /run/lock
|
|
security_opts:
|
|
- apparmor=unconfined
|
|
- name: ${KAMINO_RUN_ID:-local}-pihole-resolute
|
|
labels:
|
|
net.rkdr.mortis.molecule-run: "${KAMINO_RUN_ID:-local}"
|
|
image: ${MOLECULE_IMAGE_2604}
|
|
pre_build_image: true
|
|
pull: true
|
|
command: /sbin/init
|
|
cgroupns_mode: host
|
|
volumes:
|
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
|
tmpfs:
|
|
- /run
|
|
- /run/lock
|
|
security_opts:
|
|
- apparmor=unconfined
|
|
provisioner:
|
|
name: ansible
|
|
# One source for every play, so the converge and the negative tests in verify.yml start from
|
|
# the same valid input.
|
|
inventory:
|
|
group_vars:
|
|
all:
|
|
pihole_test_overrides:
|
|
repo:
|
|
remote: file:///opt/pihole-stub.git
|
|
config:
|
|
dns:
|
|
# not eth0, so verify proves the variable reaches pihole.toml
|
|
interface: molecule0
|
|
upstreams:
|
|
- 9.9.9.9
|
|
- 149.112.112.112
|
|
webserver:
|
|
api:
|
|
password: molecule-test-password
|
|
verifier:
|
|
name: ansible
|
|
scenario:
|
|
# molecule's default sequence minus both destroys (scripts/run_molecule_scenarios.sh removes the
|
|
# containers as soon as this scenario ends; after a local run, run `molecule destroy` yourself),
|
|
# with a check run before the converge (first-run preview) and after the idempotence run.
|
|
test_sequence:
|
|
- dependency
|
|
- cleanup
|
|
- syntax
|
|
- create
|
|
- prepare
|
|
- check
|
|
- converge
|
|
- idempotence
|
|
- check
|
|
- side_effect
|
|
- verify
|
|
- cleanup
|