Fix nested jinja statements in integration tests (#81591)

pull/81602/head
Matt Martz 2 years 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 - name: Get working order results and sort them
set_fact: 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 - name: Get broken order results and sort them
set_fact: set_fact:
broken: '{{ query("fileglob", "{{ dir }}/*.[ch]", "setvars.bat") | sort }}' broken: '{{ query("fileglob", dir ~ "/*.[ch]", "setvars.bat") | sort }}'
- assert: - assert:
that: that:

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

@ -10,7 +10,7 @@
- name: test Url lookup with ~/.netrc forced Basic auth - name: test Url lookup with ~/.netrc forced Basic auth
set_fact: 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 ignore_errors: yes
- name: assert test Url lookup with ~/.netrc forced Basic auth - name: assert test Url lookup with ~/.netrc forced Basic auth
@ -22,7 +22,7 @@
- name: test Url lookup with use_netrc=False - name: test Url lookup with use_netrc=False
set_fact: 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 - name: assert test Url lookup with netrc=False used Bearer authentication
assert: assert:

@ -25,7 +25,7 @@
- name: show jinja2 version - name: show jinja2 version
debug: 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 - name: get default group
shell: id -gn shell: id -gn
@ -760,7 +760,7 @@
that: that:
- test - test
vars: 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 - name: test jinja2 override without colon throws proper error
block: block:

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

Loading…
Cancel
Save