1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Make sure all files have trailing newline (#5076)

* Make sure all files have trailing newline.

* Adjust tests.
This commit is contained in:
Felix Fontein 2022-08-05 21:08:41 +02:00 committed by GitHub
parent 79b201ae49
commit fa6c009ff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
195 changed files with 236 additions and 173 deletions

View file

@ -700,4 +700,3 @@
that: that:
- gitlab_group_variable_state.changed - gitlab_group_variable_state.changed
- gitlab_group_variable_state.group_variable.removed|length == 1 - gitlab_group_variable_state.group_variable.removed|length == 1

View file

@ -44,7 +44,7 @@
- orig_stat.stat.size == stat_test_1.stat.size - orig_stat.stat.size == stat_test_1.stat.size
- orig_stat.stat.checksum == stat_test_1.stat.checksum - orig_stat.stat.checksum == stat_test_1.stat.checksum
- orig_stat.stat.mtime == stat_test_1.stat.mtime - orig_stat.stat.mtime == stat_test_1.stat.mtime
- stat_test_1.stat.checksum == 'blacklist aaaa\nblacklist bbbb\nblacklist cccc'|checksum - stat_test_1.stat.checksum == 'blacklist aaaa\nblacklist bbbb\nblacklist cccc\n' | checksum
- name: add new item to list - name: add new item to list
community.general.kernel_blacklist: community.general.kernel_blacklist:

View file

@ -221,4 +221,3 @@
- empty_result.query_results[0][1] | length == 0 - empty_result.query_results[0][1] | length == 0
- empty_result.query_results[0][2][0][0] == 'msdb' - empty_result.query_results[0][2][0][0] == 'msdb'
failed_when: false # known issue failed_when: false # known issue

View file

@ -17,6 +17,9 @@
- beer: Окское - beer: Окское
register: add_children_elements_unicode register: add_children_elements_unicode
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-add-children-elements-unicode.xml src: results/test-add-children-elements-unicode.xml

View file

@ -17,6 +17,9 @@
- beer: Old Rasputin - beer: Old Rasputin
register: add_children_elements register: add_children_elements
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-add-children-elements.xml src: results/test-add-children-elements.xml

View file

@ -16,6 +16,9 @@
add_children: '{{ bad_beers }}' add_children: '{{ bad_beers }}'
register: add_children_from_groupvars register: add_children_from_groupvars
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-add-children-from-groupvars.xml src: results/test-add-children-from-groupvars.xml

View file

@ -19,6 +19,9 @@
type: экстра type: экстра
register: add_children_with_attributes_unicode register: add_children_with_attributes_unicode
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-add-children-with-attributes-unicode.xml src: results/test-add-children-with-attributes-unicode.xml

View file

@ -19,6 +19,9 @@
type: light type: light
register: add_children_with_attributes register: add_children_with_attributes
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-add-children-with-attributes.xml src: results/test-add-children-with-attributes.xml

View file

@ -20,6 +20,9 @@
- beer: Old Rasputin - beer: Old Rasputin
register: add_namespaced_children_elements register: add_namespaced_children_elements
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-add-namespaced-children-elements.xml src: results/test-add-namespaced-children-elements.xml

View file

@ -18,6 +18,9 @@
- '<beer>Old Rasputin</beer>' - '<beer>Old Rasputin</beer>'
register: children_elements register: children_elements
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-add-children-elements.xml src: results/test-add-children-elements.xml

View file

@ -16,6 +16,9 @@
state: absent state: absent
register: remove_attribute register: remove_attribute
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-remove-attribute.xml src: results/test-remove-attribute.xml

View file

@ -16,6 +16,9 @@
state: absent state: absent
register: remove_element register: remove_element
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-remove-element.xml src: results/test-remove-element.xml

View file

@ -21,6 +21,9 @@
state: absent state: absent
register: remove_namespaced_attribute register: remove_namespaced_attribute
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-remove-namespaced-attribute.xml src: results/test-remove-namespaced-attribute.xml

View file

@ -21,6 +21,9 @@
state: absent state: absent
register: remove_namespaced_element register: remove_namespaced_element
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-remove-element.xml src: results/test-remove-element.xml

View file

@ -17,6 +17,9 @@
value: нет value: нет
register: set_attribute_value_unicode register: set_attribute_value_unicode
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-attribute-value-unicode.xml src: results/test-set-attribute-value-unicode.xml

View file

@ -17,6 +17,9 @@
value: 'false' value: 'false'
register: set_attribute_value register: set_attribute_value
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-attribute-value.xml src: results/test-set-attribute-value.xml

View file

@ -40,6 +40,9 @@
quantity: 20g quantity: 20g
register: set_children_elements_level register: set_children_elements_level
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-children-elements-level.xml src: results/test-set-children-elements-level.xml

View file

@ -18,6 +18,9 @@
- beer: Невское - beer: Невское
register: set_children_elements_unicode register: set_children_elements_unicode
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-children-elements-unicode.xml src: results/test-set-children-elements-unicode.xml

View file

@ -18,6 +18,9 @@
- beer: Harvest Pumpkin Ale - beer: Harvest Pumpkin Ale
register: set_children_elements register: set_children_elements
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-children-elements.xml src: results/test-set-children-elements.xml

View file

@ -16,6 +16,9 @@
value: '' value: ''
register: set_element_value_empty register: set_element_value_empty
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-element-value-empty.xml src: results/test-set-element-value-empty.xml

View file

@ -30,6 +30,9 @@
value: пять value: пять
register: set_element_second_run register: set_element_second_run
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-element-value-unicode.xml src: results/test-set-element-value-unicode.xml

View file

@ -30,6 +30,9 @@
value: '5' value: '5'
register: set_element_second_run register: set_element_second_run
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-element-value.xml src: results/test-set-element-value.xml

View file

@ -22,6 +22,9 @@
value: 'false' value: 'false'
register: set_namespaced_attribute_value register: set_namespaced_attribute_value
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-namespaced-attribute-value.xml src: results/test-set-namespaced-attribute-value.xml

View file

@ -33,6 +33,9 @@
value: '11' value: '11'
register: set_element_second_run register: set_element_second_run
- name: Add trailing newline
shell: echo "" >> /tmp/ansible-xml-namespaced-beers.xml
- name: Compare to expected result - name: Compare to expected result
copy: copy:
src: results/test-set-namespaced-element-value.xml src: results/test-set-namespaced-element-value.xml

View file

@ -77,6 +77,8 @@ class TestInterfacesFileModule(unittest.TestCase):
def compareStringWithFile(self, string, path): def compareStringWithFile(self, string, path):
# self.assertEqual("","_",msg=path) # self.assertEqual("","_",msg=path)
testfilepath = os.path.join(golden_output_path, path) testfilepath = os.path.join(golden_output_path, path)
if string and not string.endswith('\n'):
string += '\n'
goldenstring = string goldenstring = string
if not os.path.isfile(testfilepath): if not os.path.isfile(testfilepath):
f = io.open(testfilepath, 'wb') f = io.open(testfilepath, 'wb')