Test include_vars reserved variable matching (#84678)

* Add test case for include_vars

* Revise test to catch erroneous warnings
pull/84689/head
Sloane Hertel 10 months ago committed by GitHub
parent ee49adfaf4
commit 333ee8d010
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
- hosts: localhost
gather_facts: no
tasks:
- include_vars:
file: ../vars/set_host_variable.yml

@ -2,22 +2,32 @@
vars: vars:
canary: Found variable using reserved name canary: Found variable using reserved name
block: block:
- shell: ansible-playbook '{{[ role_path, "tasks", item ~ ".yml"] | path_join }}' - shell: ansible-playbook '{{[ role_path, "tasks", item.file ~ ".yml"] | path_join }}'
environment: environment:
ANSIBLE_LOCALHOST_WARNING: 0 ANSIBLE_LOCALHOST_WARNING: 0
ANSIBLE_FORCE_COLOR: 0
failed_when: false failed_when: false
loop: loop:
- play_vars - file: play_vars
- block_vars name: lipsum
- task_vars - file: block_vars
- task_vars_used name: query
- set_fact - file: task_vars
name: query
- file: task_vars_used
name: q
- file: set_fact
name: lookup
- file: include_vars
name: query
register: play_out register: play_out
- name: check they all complain about bad defined var - name: check they all complain about bad defined var
assert: assert:
that: that:
- canary in item['stderr'] - item.stderr == warning_message
loop: '{{play_out.results}}' loop: '{{play_out.results}}'
loop_control: loop_control:
label: '{{item.item}}' label: '{{item.item.file}}'
vars:
warning_message: "[WARNING]: {{ canary }}: {{ item.item.name }}"

@ -0,0 +1 @@
query: overwrite global Jinja2 function
Loading…
Cancel
Save