Files
Ansible-Bootstrap/tests/inputs/_assert_inputs.yml
T

23 lines
811 B
YAML

---
- name: "Validate the fixture ({{ inf.name }})"
block:
- name: "Run the validator ({{ inf.name }})"
validate_inputs:
specs:
- "{{ playbook_dir }}/fixture_spec.yml"
vars:
fixture: "{{ inf.value }}"
register: inputs_result
rescue:
- name: "Keep the failed result ({{ inf.name }})"
ansible.builtin.set_fact:
inputs_result: "{{ ansible_failed_result }}"
- name: "Assert the reported violations ({{ inf.name }})"
ansible.builtin.assert:
that:
- (inputs_result.errors | default([])) | sort == inf.expect | sort
- "'topsecret-value' not in (inputs_result | to_json)"
fail_msg: "[inputs {{ inf.name }}] expected {{ inf.expect }}, got {{ inputs_result.errors | default([]) }}"
success_msg: "[inputs {{ inf.name }}] OK"