GRM-20: fix molecule idempotence with mode-specific systemd templates
This commit is contained in:
@@ -7,9 +7,20 @@
|
||||
ansible.builtin.include_vars:
|
||||
dir: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/defaults"
|
||||
tasks:
|
||||
- name: Check Docker mode systemd template exists
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/systemd/system/gitea-runner-docker@.service"
|
||||
register: docker_template_stat
|
||||
|
||||
- name: Assert Docker mode systemd template exists
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- docker_template_stat.stat.exists
|
||||
fail_msg: "Docker systemd template is missing"
|
||||
|
||||
- name: Read rendered Docker systemd template
|
||||
ansible.builtin.slurp:
|
||||
src: "/etc/systemd/system/gitea-runner@.service"
|
||||
src: "/etc/systemd/system/gitea-runner-docker@.service"
|
||||
register: docker_template
|
||||
|
||||
- name: Assert Docker mode template contains expected directives
|
||||
@@ -23,6 +34,30 @@
|
||||
- "'Restart=on-failure' in docker_template.content | b64decode"
|
||||
fail_msg: "Docker systemd template is missing expected directives"
|
||||
|
||||
- name: Check Binary mode systemd template exists
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/systemd/system/gitea-runner-binary@.service"
|
||||
register: binary_template_stat
|
||||
|
||||
- name: Assert Binary mode systemd template exists
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- binary_template_stat.stat.exists
|
||||
fail_msg: "Binary systemd template is missing"
|
||||
|
||||
- name: Read rendered Binary systemd template
|
||||
ansible.builtin.slurp:
|
||||
src: "/etc/systemd/system/gitea-runner-binary@.service"
|
||||
register: binary_template
|
||||
|
||||
- name: Assert Binary mode template contains expected directives
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "'Type=simple' in binary_template.content | b64decode"
|
||||
- "'ExecStart={{ gitea_runner_binary_path }}' in binary_template.content | b64decode"
|
||||
- "'Restart=on-failure' in binary_template.content | b64decode"
|
||||
fail_msg: "Binary systemd template is missing expected directives"
|
||||
|
||||
- name: Read rendered prune service template
|
||||
ansible.builtin.slurp:
|
||||
src: "/etc/systemd/system/docker-prune.service"
|
||||
|
||||
Reference in New Issue
Block a user