41 lines
1.7 KiB
YAML
Executable File
41 lines
1.7 KiB
YAML
Executable File
---
|
|
- name: Apply invalid test settings
|
|
ansible.builtin.set_fact:
|
|
"{{ setting.key }}": "{{ setting.value }}"
|
|
loop: "{{ invalid_settings | dict2items }}"
|
|
loop_control:
|
|
loop_var: setting
|
|
|
|
- name: Verify validation rejects the input
|
|
block:
|
|
- name: Run role preflight with invalid settings
|
|
ansible.builtin.include_role:
|
|
name: ansible-role-luanti-wasm
|
|
tasks_from: validate.yml
|
|
- name: Fail if invalid configuration was accepted
|
|
ansible.builtin.fail:
|
|
msg: "Invalid configuration was accepted: {{ invalid_settings }}"
|
|
rescue:
|
|
- name: Require a real assertion failure, not a template error or test sentinel
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ansible_failed_task.action == 'ansible.builtin.assert'
|
|
- ansible_failed_task.name is match('Validate|Require an explicit')
|
|
- (ansible_failed_result.results | default([ansible_failed_result]) | selectattr('failed', 'defined') | selectattr('failed') | list | length) > 0
|
|
- name: Check each failed assertion, including loop result envelopes
|
|
ansible.builtin.assert:
|
|
that:
|
|
- rejection.assertion is defined
|
|
- rejection.evaluated_to is defined
|
|
- not rejection.evaluated_to
|
|
loop: "{{ ansible_failed_result.results | default([ansible_failed_result]) | selectattr('failed', 'defined') | selectattr('failed') | list }}"
|
|
loop_control:
|
|
loop_var: rejection
|
|
always:
|
|
- name: Restore valid settings
|
|
ansible.builtin.set_fact:
|
|
"{{ setting.key }}": "{{ _luanti_baseline[setting.key] }}"
|
|
loop: "{{ invalid_settings | dict2items }}"
|
|
loop_control:
|
|
loop_var: setting
|