Compare commits

...
Author SHA1 Message Date
Defame1297 2865573429 test(gitea_runner): fold the disk-pressure run into the failed-download case
Build / build (pull_request) Successful in 38s
Lint / lint (pull_request) Successful in 2m30s
Molecule / molecule (pull_request) Successful in 3m43s
The verify step ran the whole role once only to set the disk threshold to 0. Prune runs
before update in tasks/main.yml, so the failed-download run can carry that input: the
pressure units are removed before the download fails at staging. The exact staging
message the rescue asserts comes only from update.yml, so a prune error still fails it.
The run with the scenario's inputs stays before the remove path, which needs the units back.

The forced re-registration child runs now start once instead of per host: they check only
controller state and group_vars, and run_once gives every host the registered results.

Closes #459

Assisted-by: Claude Code
2026-11-28 20:39:32 +00:00
+38 -38
View File
@@ -359,23 +359,26 @@
loop_var: gitea_runner_test_path loop_var: gitea_runner_test_path
# 6.0.2 has a wrong checksum file (prepare.yml): the download must fail before anything is # 6.0.2 has a wrong checksum file (prepare.yml): the download must fail before anything is
# stopped, so the runner keeps running 6.0.1. # stopped, so the runner keeps running 6.0.1. The same run sets the disk threshold to 0: prune
- name: Verify a failed download leaves the runner running # runs before update, so the pressure units are already removed when the download fails.
- name: Verify a failed download leaves the runner running, and turning the pressure prune off
hosts: all hosts: all
gather_facts: false gather_facts: false
tasks: tasks:
- name: Update to a release whose checksum does not match - name: Update to a release whose checksum does not match
block: block:
- name: Include the role with gitea_runner_version 6.0.2 - name: Include the role with gitea_runner_version 6.0.2 and the disk threshold at 0
ansible.builtin.include_role: ansible.builtin.include_role:
name: mortis.kamino.gitea_runner name: mortis.kamino.gitea_runner
vars: vars:
gitea_runner_version: 6.0.2 gitea_runner_version: 6.0.2
gitea_runner_docker_prune_disk_threshold_percent: 0
- name: Fail because the include returned - name: Fail because the include returned
ansible.builtin.fail: ansible.builtin.fail:
msg: The role accepted a binary with a wrong checksum msg: The role accepted a binary with a wrong checksum
rescue: rescue:
# The message comes only from the staging rescue, so a prune error fails this assert.
- name: The staging failed, and nothing else failed first - name: The staging failed, and nothing else failed first
ansible.builtin.assert: ansible.builtin.assert:
that: that:
@@ -407,6 +410,31 @@
- not gitea_runner_test_staged.stat.exists - not gitea_runner_test_staged.stat.exists
quiet: true quiet: true
- name: Stat the pressure units and script
ansible.builtin.stat:
path: "{{ gitea_runner_test_path }}"
loop:
- /etc/systemd/system/gitea-runner-docker-prune-pressure.service
- /etc/systemd/system/gitea-runner-docker-prune-pressure.timer
- /usr/local/sbin/gitea-runner-docker-prune-disk-check
loop_control:
loop_var: gitea_runner_test_path
register: gitea_runner_test_pressure_off
- name: Ask systemd about the pressure timer after turning it off
ansible.builtin.systemd:
name: gitea-runner-docker-prune-pressure.timer
register: gitea_runner_test_pressure_timer_off
# The module errors for a unit that no longer exists, which is also a pass.
failed_when: false
- name: The pressure units are gone and the timer is not active
ansible.builtin.assert:
that:
- gitea_runner_test_pressure_off.results | map(attribute='stat') | map(attribute='exists') | select | list | length == 0
- gitea_runner_test_pressure_timer_off.status.ActiveState | default('inactive') != 'active'
quiet: true
# Each input assert, through the main entry point. Every one runs in validate.yml, before any # Each input assert, through the main entry point. Every one runs in validate.yml, before any
# change. # change.
- name: Verify the input asserts - name: Verify the input asserts
@@ -448,8 +476,9 @@
label: "{{ gitea_runner_test_refused.name }}" label: "{{ gitea_runner_test_refused.name }}"
# The CI guard and the mint-before-drop order of a forced re-registration, through a child # The CI guard and the mint-before-drop order of a forced re-registration, through a child
# ansible-playbook against this instance (see force_register.yml). Neither case may touch the # ansible-playbook against one instance (see force_register.yml). Neither case may touch the
# registration or stop the runner. # registration or stop the runner. The children run once: what they check is controller state
# and group_vars, the same for every host, and run_once gives every host their results.
- name: Verify the forced re-registration guards - name: Verify the forced re-registration guards
hosts: all hosts: all
gather_facts: false gather_facts: false
@@ -465,6 +494,7 @@
- name: Force a re-registration under each CI variable, as a child process with only that one set - name: Force a re-registration under each CI variable, as a child process with only that one set
delegate_to: localhost delegate_to: localhost
run_once: true
ansible.builtin.command: ansible.builtin.command:
argv: argv:
- ansible-playbook - ansible-playbook
@@ -497,6 +527,7 @@
- name: Force a re-registration outside CI with no token host, as a child process - name: Force a re-registration outside CI with no token host, as a child process
delegate_to: localhost delegate_to: localhost
run_once: true
ansible.builtin.command: ansible.builtin.command:
argv: argv:
- ansible-playbook - ansible-playbook
@@ -550,43 +581,12 @@
- gitea_runner_test_unit.status.ActiveState == 'active' - gitea_runner_test_unit.status.ActiveState == 'active'
quiet: true quiet: true
# A threshold of 0 removes the pressure units; the run after it, with the scenario's inputs, # The failed-download run above removed the pressure units; this run, with the scenario's inputs,
# puts them back, so the remove path below still has them to remove. # puts them back, so the remove path below still has them to remove.
- name: Verify turning the pressure prune off - name: Verify turning the pressure prune on again
hosts: all hosts: all
gather_facts: false gather_facts: false
tasks: tasks:
- name: Run the role with the disk threshold at 0
ansible.builtin.include_role:
name: mortis.kamino.gitea_runner
vars:
gitea_runner_docker_prune_disk_threshold_percent: 0
- name: Stat the pressure units and script
ansible.builtin.stat:
path: "{{ gitea_runner_test_path }}"
loop:
- /etc/systemd/system/gitea-runner-docker-prune-pressure.service
- /etc/systemd/system/gitea-runner-docker-prune-pressure.timer
- /usr/local/sbin/gitea-runner-docker-prune-disk-check
loop_control:
loop_var: gitea_runner_test_path
register: gitea_runner_test_pressure_off
- name: Ask systemd about the pressure timer after turning it off
ansible.builtin.systemd:
name: gitea-runner-docker-prune-pressure.timer
register: gitea_runner_test_pressure_timer_off
# The module errors for a unit that no longer exists, which is also a pass.
failed_when: false
- name: The pressure units are gone and the timer is not active
ansible.builtin.assert:
that:
- gitea_runner_test_pressure_off.results | map(attribute='stat') | map(attribute='exists') | select | list | length == 0
- gitea_runner_test_pressure_timer_off.status.ActiveState | default('inactive') != 'active'
quiet: true
- name: Run the role again with the scenario's inputs - name: Run the role again with the scenario's inputs
ansible.builtin.include_role: ansible.builtin.include_role:
name: mortis.kamino.gitea_runner name: mortis.kamino.gitea_runner