Fix nested jinja statements in integration tests (#81591)

pull/81602/head
Matt Martz 9 months ago committed by GitHub
parent 5dc3a2ee6d
commit 509be19357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,11 +20,11 @@
- name: Get working order results and sort them
set_fact:
working: '{{ query("fileglob", "setvars.bat", "{{ dir }}/*.[ch]") | sort }}'
working: '{{ query("fileglob", "setvars.bat", dir ~ "/*.[ch]") | sort }}'
- name: Get broken order results and sort them
set_fact:
broken: '{{ query("fileglob", "{{ dir }}/*.[ch]", "setvars.bat") | sort }}'
broken: '{{ query("fileglob", dir ~ "/*.[ch]", "setvars.bat") | sort }}'
- assert:
that:

@ -1,6 +1,6 @@
- name: Test that retrieving a url works
set_fact:
web_data: "{{ lookup('url', 'https://{{ httpbin_host }}/get?one') }}"
web_data: "{{ lookup('url', 'https://' ~ httpbin_host ~ '/get?one') }}"
- name: Assert that the url was retrieved
assert:
@ -9,7 +9,7 @@
- name: Test that retrieving a url with invalid cert fails
set_fact:
web_data: "{{ lookup('url', 'https://{{ badssl_host }}/') }}"
web_data: "{{ lookup('url', 'https://' ~ badssl_host ~ '/') }}"
ignore_errors: True
register: url_invalid_cert
@ -20,12 +20,12 @@
- name: Test that retrieving a url with invalid cert with validate_certs=False works
set_fact:
web_data: "{{ lookup('url', 'https://{{ badssl_host }}/', validate_certs=False) }}"
web_data: "{{ lookup('url', 'https://' ~ badssl_host ~ '/', validate_certs=False) }}"
register: url_no_validate_cert
- assert:
that:
- "'{{ badssl_host_substring }}' in web_data"
- badssl_host_substring in web_data
- vars:
url: https://{{ httpbin_host }}/get

@ -10,7 +10,7 @@
- name: test Url lookup with ~/.netrc forced Basic auth
set_fact:
web_data: "{{ lookup('ansible.builtin.url', 'https://{{ httpbin_host }}/bearer', headers={'Authorization':'Bearer foobar'}) }}"
web_data: "{{ lookup('ansible.builtin.url', 'https://' ~ httpbin_host ~ '/bearer', headers={'Authorization':'Bearer foobar'}) }}"
ignore_errors: yes
- name: assert test Url lookup with ~/.netrc forced Basic auth
@ -22,7 +22,7 @@
- name: test Url lookup with use_netrc=False
set_fact:
web_data: "{{ lookup('ansible.builtin.url', 'https://{{ httpbin_host }}/bearer', headers={'Authorization':'Bearer foobar'}, use_netrc='False') }}"
web_data: "{{ lookup('ansible.builtin.url', 'https://' ~ httpbin_host ~ '/bearer', headers={'Authorization':'Bearer foobar'}, use_netrc='False') }}"
- name: assert test Url lookup with netrc=False used Bearer authentication
assert:

@ -25,7 +25,7 @@
- name: show jinja2 version
debug:
msg: "{{ lookup('pipe', '{{ ansible_python[\"executable\"] }} -c \"import jinja2; print(jinja2.__version__)\"') }}"
msg: "{{ lookup('pipe', ansible_python.executable ~ ' -c \"import jinja2; print(jinja2.__version__)\"') }}"
- name: get default group
shell: id -gn
@ -760,7 +760,7 @@
that:
- test
vars:
test: "{{ lookup('file', '{{ output_dir }}/empty_template.templated')|length == 0 }}"
test: "{{ lookup('file', output_dir ~ '/empty_template.templated')|length == 0 }}"
- name: test jinja2 override without colon throws proper error
block:

@ -12,4 +12,4 @@
- "'foobar' not in data"
- "'\"foo\" \"bar\"' in data"
vars:
data: "{{ lookup('file', '{{ output_dir }}/macro_override.out') }}"
data: "{{ lookup('file', output_dir ~ '/macro_override.out') }}"

Loading…
Cancel
Save