GRM-9: test: add parameterized multi-platform Molecule testing (Arch, Ubuntu 24/26, Debian 12/13)
This commit is contained in:
@@ -58,9 +58,36 @@ test-unit:
|
|||||||
pytest-cov:
|
pytest-cov:
|
||||||
$(BIN)/pytest tests/unit/ -v --cov=src/gitea_runner_manager --cov-report=term-missing --cov-fail-under=100
|
$(BIN)/pytest tests/unit/ -v --cov=src/gitea_runner_manager --cov-report=term-missing --cov-fail-under=100
|
||||||
|
|
||||||
|
MOLECULE := $(realpath $(BIN))/molecule
|
||||||
|
MOLECULE_BASE := cd ansible/roles/gitea-runner && ANSIBLE_ALLOW_BROKEN_CONDITIONALS=true $(MOLECULE)
|
||||||
|
|
||||||
|
# Quick local test: Ubuntu 22.04 only
|
||||||
molecule:
|
molecule:
|
||||||
cd ansible/roles/gitea-runner && ANSIBLE_ALLOW_BROKEN_CONDITIONALS=true $(realpath $(BIN))/molecule test
|
$(MOLECULE_BASE) test
|
||||||
cd ansible/roles/gitea-runner && ANSIBLE_ALLOW_BROKEN_CONDITIONALS=true $(realpath $(BIN))/molecule test -s binary
|
$(MOLECULE_BASE) test -s binary
|
||||||
|
|
||||||
|
# Docker mode tests for all platforms (sequential; override env vars for CI matrix parallelisation)
|
||||||
|
molecule-docker:
|
||||||
|
@echo "Testing Docker mode on all platforms..."
|
||||||
|
$(MOLECULE_BASE) test
|
||||||
|
MOLECULE_PLATFORM_NAME=ubuntu-2404 MOLECULE_PLATFORM_IMAGE=geerlingguy/docker-ubuntu2404-ansible:latest $(MOLECULE_BASE) test
|
||||||
|
MOLECULE_PLATFORM_NAME=ubuntu-2604 MOLECULE_PLATFORM_IMAGE=geerlingguy/docker-ubuntu2604-ansible:latest $(MOLECULE_BASE) test
|
||||||
|
MOLECULE_PLATFORM_NAME=debian-12 MOLECULE_PLATFORM_IMAGE=geerlingguy/docker-debian12-ansible:latest $(MOLECULE_BASE) test
|
||||||
|
MOLECULE_PLATFORM_NAME=debian-13 MOLECULE_PLATFORM_IMAGE=geerlingguy/docker-debian13-ansible:latest $(MOLECULE_BASE) test
|
||||||
|
MOLECULE_PLATFORM_NAME=archlinux MOLECULE_PLATFORM_IMAGE=marcstraube/archlinux-ansible:latest MOLECULE_PLATFORM_COMMAND=/usr/lib/systemd/systemd $(MOLECULE_BASE) test
|
||||||
|
|
||||||
|
# Binary mode tests for all platforms (sequential; override env vars for CI matrix parallelisation)
|
||||||
|
molecule-binary:
|
||||||
|
@echo "Testing Binary mode on all platforms..."
|
||||||
|
$(MOLECULE_BASE) test -s binary
|
||||||
|
MOLECULE_PLATFORM_NAME=ubuntu-2404 MOLECULE_PLATFORM_IMAGE=geerlingguy/docker-ubuntu2404-ansible:latest $(MOLECULE_BASE) test -s binary
|
||||||
|
MOLECULE_PLATFORM_NAME=ubuntu-2604 MOLECULE_PLATFORM_IMAGE=geerlingguy/docker-ubuntu2604-ansible:latest $(MOLECULE_BASE) test -s binary
|
||||||
|
MOLECULE_PLATFORM_NAME=debian-12 MOLECULE_PLATFORM_IMAGE=geerlingguy/docker-debian12-ansible:latest $(MOLECULE_BASE) test -s binary
|
||||||
|
MOLECULE_PLATFORM_NAME=debian-13 MOLECULE_PLATFORM_IMAGE=geerlingguy/docker-debian13-ansible:latest $(MOLECULE_BASE) test -s binary
|
||||||
|
MOLECULE_PLATFORM_NAME=archlinux MOLECULE_PLATFORM_IMAGE=marcstraube/archlinux-ansible:latest MOLECULE_PLATFORM_COMMAND=/usr/lib/systemd/systemd $(MOLECULE_BASE) test -s binary
|
||||||
|
|
||||||
|
# All platform tests (sequential; use CI matrix for parallel execution)
|
||||||
|
molecule-all: molecule-docker molecule-binary
|
||||||
|
|
||||||
test: test-all
|
test: test-all
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ driver:
|
|||||||
name: docker
|
name: docker
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: instance
|
- name: ${MOLECULE_PLATFORM_NAME:-ubuntu-2204}
|
||||||
image: geerlingguy/docker-ubuntu2204-ansible:latest
|
image: ${MOLECULE_PLATFORM_IMAGE:-geerlingguy/docker-ubuntu2204-ansible:latest}
|
||||||
command: sleep infinity
|
command: ${MOLECULE_PLATFORM_COMMAND:-sleep infinity}
|
||||||
volumes:
|
volumes:
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||||
cgroupns_mode: host
|
cgroupns_mode: host
|
||||||
|
|||||||
@@ -14,12 +14,16 @@
|
|||||||
state: present
|
state: present
|
||||||
when: ansible_facts['os_family'] == 'Debian'
|
when: ansible_facts['os_family'] == 'Debian'
|
||||||
|
|
||||||
|
- name: Update pacman cache
|
||||||
|
community.general.pacman:
|
||||||
|
update_cache: true
|
||||||
|
when: ansible_facts['os_family'] == 'Archlinux'
|
||||||
|
|
||||||
- name: Ensure /etc/docker directory exists
|
- name: Ensure /etc/docker directory exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /etc/docker
|
path: /etc/docker
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
when: ansible_facts['os_family'] == 'Debian'
|
|
||||||
|
|
||||||
- name: Configure Docker daemon for vfs storage driver (DinD)
|
- name: Configure Docker daemon for vfs storage driver (DinD)
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
@@ -27,4 +31,3 @@
|
|||||||
content: |
|
content: |
|
||||||
{"storage-driver": "vfs"}
|
{"storage-driver": "vfs"}
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
when: ansible_facts['os_family'] == 'Debian'
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ driver:
|
|||||||
name: docker
|
name: docker
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: instance
|
- name: ${MOLECULE_PLATFORM_NAME:-ubuntu-2204}
|
||||||
image: geerlingguy/docker-ubuntu2204-ansible:latest
|
image: ${MOLECULE_PLATFORM_IMAGE:-geerlingguy/docker-ubuntu2204-ansible:latest}
|
||||||
command: sleep infinity
|
command: ${MOLECULE_PLATFORM_COMMAND:-sleep infinity}
|
||||||
volumes:
|
volumes:
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||||
cgroupns_mode: host
|
cgroupns_mode: host
|
||||||
|
|||||||
Reference in New Issue
Block a user