Do not use bare vars in integration tests. (#17599)

pull/17567/head
Matt Clay 8 years ago committed by Brian Coca
parent b93de25204
commit 16baef1f72

@ -292,7 +292,7 @@
- name: test a with_items loop skipping a single item - name: test a with_items loop skipping a single item
debug: var=item debug: var=item
with_items: cond_list_of_items.results with_items: "{{cond_list_of_items.results}}"
when: item != 'b' when: item != 'b'
register: result register: result

@ -115,7 +115,7 @@
- name: test with_subelements - name: test with_subelements
set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}" set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}"
with_subelements: with_subelements:
- element_data - "{{element_data}}"
- the_list - the_list
- name: verify with_subelements results - name: verify with_subelements results
@ -129,7 +129,7 @@
- name: test with_subelements in subkeys - name: test with_subelements in subkeys
set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}" set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}"
with_subelements: with_subelements:
- element_data - "{{element_data}}"
- the.sub.key.list - the.sub.key.list
- name: verify with_subelements in subkeys results - name: verify with_subelements in subkeys results
@ -143,7 +143,7 @@
- name: test with_subelements with missing key or subkey - name: test with_subelements with missing key or subkey
set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}" set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}"
with_subelements: with_subelements:
- element_data_missing - "{{element_data_missing}}"
- the.sub.key.list - the.sub.key.list
- skip_missing: yes - skip_missing: yes
register: _subelements_missing_subkeys register: _subelements_missing_subkeys
@ -227,7 +227,7 @@
- name: create indexed list - name: create indexed list
set_fact: "{{ item[1] + item[0]|string }}=set" set_fact: "{{ item[1] + item[0]|string }}=set"
with_indexed_items: list_data.stdout_lines with_indexed_items: "{{list_data.stdout_lines}}"
- name: verify with_indexed_items result - name: verify with_indexed_items result
assert: assert:

@ -170,7 +170,7 @@
- name: use bare interpolation - name: use bare interpolation
debug: msg="got {{item}}" debug: msg="got {{item}}"
with_items: things1 with_items: "{{things1}}"
register: bare_var register: bare_var
- name: verify that list was interpolated - name: verify that list was interpolated
@ -187,7 +187,7 @@
- name: use list with undefined var in it - name: use list with undefined var in it
debug: msg={{item}} debug: msg={{item}}
with_items: things2 with_items: "{{things2}}"
ignore_errors: True ignore_errors: True

@ -112,7 +112,7 @@
- name: assert grant access for user2 on multiple database - name: assert grant access for user2 on multiple database
assert: { that: "'{{ item }}' in result.stdout" } assert: { that: "'{{ item }}' in result.stdout" }
with_items: db_names with_items: "{{db_names}}"
- include: remove_user.yml user_name={{user_name_1}} user_password={{ user_password_1 }} - include: remove_user.yml user_name={{user_name_1}} user_password={{ user_password_1 }}

@ -232,7 +232,7 @@
- name: install OS packages that are needed for SNI on old python - name: install OS packages that are needed for SNI on old python
package: package:
name: "{{ item }}" name: "{{ item }}"
with_items: "{{ uri_os_packages[ansible_os_family] }}" with_items: "{{ uri_os_packages[ansible_os_family] | default([]) }}"
when: not ansible_python.has_sslcontext and not is_ubuntu_precise|bool when: not ansible_python.has_sslcontext and not is_ubuntu_precise|bool
- name: install python modules for Older Python SNI verification - name: install python modules for Older Python SNI verification
@ -268,7 +268,7 @@
package: package:
name: "{{ item }}" name: "{{ item }}"
state: absent state: absent
with_items: "{{ uri_os_packages[ansible_os_family] }}" with_items: "{{ uri_os_packages[ansible_os_family] | default([]) }}"
when: not ansible_python.has_sslcontext and not is_ubuntu_precise|bool when: not ansible_python.has_sslcontext and not is_ubuntu_precise|bool
- name: validate the status_codes are correct - name: validate the status_codes are correct

@ -61,7 +61,6 @@ class TestTemplar(unittest.TestCase):
self.assertEqual(templar.template("{{foo}}\n"), "bar\n") self.assertEqual(templar.template("{{foo}}\n"), "bar\n")
self.assertEqual(templar.template("{{foo}}\n", preserve_trailing_newlines=True), "bar\n") self.assertEqual(templar.template("{{foo}}\n", preserve_trailing_newlines=True), "bar\n")
self.assertEqual(templar.template("{{foo}}\n", preserve_trailing_newlines=False), "bar") self.assertEqual(templar.template("{{foo}}\n", preserve_trailing_newlines=False), "bar")
self.assertEqual(templar.template("foo", convert_bare=True), "bar")
self.assertEqual(templar.template("{{bam}}"), "bar") self.assertEqual(templar.template("{{bam}}"), "bar")
self.assertEqual(templar.template("{{num}}"), 1) self.assertEqual(templar.template("{{num}}"), 1)
self.assertEqual(templar.template("{{var_true}}"), True) self.assertEqual(templar.template("{{var_true}}"), True)

Loading…
Cancel
Save