From 16baef1f721be3ec20a83885700739ad77f42c6f Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 15 Sep 2016 14:41:54 -0700 Subject: [PATCH] Do not use bare vars in integration tests. (#17599) --- test/integration/roles/test_conditionals/tasks/main.yml | 2 +- test/integration/roles/test_iterators/tasks/main.yml | 8 ++++---- test/integration/roles/test_lookups/tasks/main.yml | 4 ++-- test/integration/roles/test_mysql_user/tasks/main.yml | 2 +- test/integration/roles/test_uri/tasks/main.yml | 4 ++-- test/units/template/test_templar.py | 1 - 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/test/integration/roles/test_conditionals/tasks/main.yml b/test/integration/roles/test_conditionals/tasks/main.yml index c4731a206b9..abe7bd24acc 100644 --- a/test/integration/roles/test_conditionals/tasks/main.yml +++ b/test/integration/roles/test_conditionals/tasks/main.yml @@ -292,7 +292,7 @@ - name: test a with_items loop skipping a single item debug: var=item - with_items: cond_list_of_items.results + with_items: "{{cond_list_of_items.results}}" when: item != 'b' register: result diff --git a/test/integration/roles/test_iterators/tasks/main.yml b/test/integration/roles/test_iterators/tasks/main.yml index 3f8d8b2848f..584144af771 100644 --- a/test/integration/roles/test_iterators/tasks/main.yml +++ b/test/integration/roles/test_iterators/tasks/main.yml @@ -115,7 +115,7 @@ - name: test with_subelements set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}" with_subelements: - - element_data + - "{{element_data}}" - the_list - name: verify with_subelements results @@ -129,7 +129,7 @@ - name: test with_subelements in subkeys set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}" with_subelements: - - element_data + - "{{element_data}}" - the.sub.key.list - name: verify with_subelements in subkeys results @@ -143,7 +143,7 @@ - name: test with_subelements with missing key or subkey set_fact: "{{ '_'+ item.0.id + item.1 }}={{ item.1 }}" with_subelements: - - element_data_missing + - "{{element_data_missing}}" - the.sub.key.list - skip_missing: yes register: _subelements_missing_subkeys @@ -227,7 +227,7 @@ - name: create indexed list 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 assert: diff --git a/test/integration/roles/test_lookups/tasks/main.yml b/test/integration/roles/test_lookups/tasks/main.yml index 9539c45feb9..f861ceaedeb 100644 --- a/test/integration/roles/test_lookups/tasks/main.yml +++ b/test/integration/roles/test_lookups/tasks/main.yml @@ -170,7 +170,7 @@ - name: use bare interpolation debug: msg="got {{item}}" - with_items: things1 + with_items: "{{things1}}" register: bare_var - name: verify that list was interpolated @@ -187,7 +187,7 @@ - name: use list with undefined var in it debug: msg={{item}} - with_items: things2 + with_items: "{{things2}}" ignore_errors: True diff --git a/test/integration/roles/test_mysql_user/tasks/main.yml b/test/integration/roles/test_mysql_user/tasks/main.yml index b0754390403..db6a74dc5cb 100644 --- a/test/integration/roles/test_mysql_user/tasks/main.yml +++ b/test/integration/roles/test_mysql_user/tasks/main.yml @@ -112,7 +112,7 @@ - name: assert grant access for user2 on multiple database 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 }} diff --git a/test/integration/roles/test_uri/tasks/main.yml b/test/integration/roles/test_uri/tasks/main.yml index afa521c96e7..bfb193a26b1 100644 --- a/test/integration/roles/test_uri/tasks/main.yml +++ b/test/integration/roles/test_uri/tasks/main.yml @@ -232,7 +232,7 @@ - name: install OS packages that are needed for SNI on old python package: 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 - name: install python modules for Older Python SNI verification @@ -268,7 +268,7 @@ package: name: "{{ item }}" 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 - name: validate the status_codes are correct diff --git a/test/units/template/test_templar.py b/test/units/template/test_templar.py index 481dc3e8d50..81475418e0d 100644 --- a/test/units/template/test_templar.py +++ b/test/units/template/test_templar.py @@ -61,7 +61,6 @@ class TestTemplar(unittest.TestCase): 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=False), "bar") - self.assertEqual(templar.template("foo", convert_bare=True), "bar") self.assertEqual(templar.template("{{bam}}"), "bar") self.assertEqual(templar.template("{{num}}"), 1) self.assertEqual(templar.template("{{var_true}}"), True)