Copied from the maintainer's local role and reworked for the Collection: the binary swap and rollback of an update go through the internal _binary_update role, input checks move to tasks/validate.yml, the removal ends the role, commands take argv, and the molecule tooling needs an explicit collections requirements file. Adds a molecule scenario with stub Docker, runner and release files. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
29 lines
1.8 KiB
YAML
29 lines
1.8 KiB
YAML
---
|
|
# One refused input: runs the main entry point with that input and asserts that the expected
|
|
# assert, not something else, stopped it. Input: gitea_runner_test_refused (name, vars, expect).
|
|
# Task vars cannot come from a template as a whole, so each input under test is passed with
|
|
# its usual value as the default.
|
|
- name: "Run the role, case {{ gitea_runner_test_refused.name }}"
|
|
block:
|
|
- name: "Include the role, case {{ gitea_runner_test_refused.name }}"
|
|
ansible.builtin.include_role:
|
|
name: mortis.kamino.gitea_runner
|
|
vars:
|
|
gitea_runner_version: "{{ gitea_runner_test_refused.vars.gitea_runner_version | default('6.0.1') }}"
|
|
gitea_runner_registration_scope: "{{ gitea_runner_test_refused.vars.gitea_runner_registration_scope | default('') }}"
|
|
gitea_runner_docker_prune_schedule: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_schedule | default('Sun *-*-* 04:30:00') }}"
|
|
gitea_runner_docker_prune_image_age: "{{ gitea_runner_test_refused.vars.gitea_runner_docker_prune_image_age | default('168h') }}"
|
|
gitea_runner_molecule_enabled: "{{ gitea_runner_test_refused.vars.gitea_runner_molecule_enabled | default(false) }}"
|
|
|
|
# Only reached when the include returned. The message must not contain the expected
|
|
# text, so the rescue below cannot mistake it for the assert.
|
|
- name: "Fail because the include returned, case {{ gitea_runner_test_refused.name }}"
|
|
ansible.builtin.fail:
|
|
msg: The role accepted the input
|
|
rescue:
|
|
- name: "The expected assert fired, case {{ gitea_runner_test_refused.name }}"
|
|
ansible.builtin.assert:
|
|
that: gitea_runner_test_refused.expect in ansible_failed_result.msg | default('')
|
|
fail_msg: "Expected '{{ gitea_runner_test_refused.expect }}', got: {{ ansible_failed_result.msg | default('') }}"
|
|
quiet: true
|