Files
grm/ansible/roles/gitea-runner/molecule/update/verify.yml
T
Emil Simeonov 39ef86647c GRM-19: add molecule tests for template content, deregister, and update workflows
- template-content: Verifies rendered systemd template contains correct
  directives for docker mode (Type=oneshot, RemainAfterExit=yes) and
  prune service/timer content.
- deregister: Installs runner, creates fake .runner file, runs deregister
  tasks, verifies .runner file is removed.
- update: Installs docker and binary runners, runs update tasks, verifies
  image/binary and data directories remain intact after update.

These scenarios bridge gaps where the deregister task file and update
workflows were not covered by existing molecule tests.
2026-06-19 03:24:19 +02:00

64 lines
2.2 KiB
YAML

---
- name: Verify
hosts: all
become: true
pre_tasks:
- name: Load role defaults
ansible.builtin.include_vars:
dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/defaults"
tasks:
- name: Check Docker runner image still exists after update
ansible.builtin.command: docker images gitea/runner --format '{{ '{{' }} .Repository {{ '}}' }}:{{ '{{' }} .Tag {{ '}}' }}'
register: image_list
changed_when: false
- name: Assert runner image exists after update
ansible.builtin.assert:
that:
- "'gitea/runner' in image_list.stdout"
fail_msg: "Runner Docker image missing after update"
- name: Check binary runner executable still exists after update
ansible.builtin.stat:
path: "{{ gitea_runner_binary_path }}"
register: binary_stat
- name: Assert binary executable exists after update
ansible.builtin.assert:
that:
- binary_stat.stat.exists
fail_msg: "Binary runner executable missing after update"
- name: Check systemd template still exists
ansible.builtin.stat:
path: "/etc/systemd/system/gitea-runner@.service"
register: service_stat
- name: Assert systemd template still exists after update
ansible.builtin.assert:
that:
- service_stat.stat.exists
fail_msg: "Systemd template unit missing after update"
- name: Check Docker mode data directory still exists
ansible.builtin.stat:
path: "/var/lib/gitea-runner/update-docker-runner"
register: docker_data_stat
- name: Assert Docker mode data directory exists after update
ansible.builtin.assert:
that:
- docker_data_stat.stat.exists
fail_msg: "Docker runner data directory missing after update"
- name: Check Binary mode data directory still exists
ansible.builtin.stat:
path: "/var/lib/gitea-runner/update-binary-runner"
register: binary_data_stat
- name: Assert Binary mode data directory exists after update
ansible.builtin.assert:
that:
- binary_data_stat.stat.exists
fail_msg: "Binary runner data directory missing after update"