diff options
Diffstat (limited to 'test/integration')
5 files changed, 44 insertions, 0 deletions
diff --git a/test/integration/targets/lookup_template/files/trim_blocks_false.expected b/test/integration/targets/lookup_template/files/trim_blocks_false.expected new file mode 100644 index 0000000000..283cefc8df --- /dev/null +++ b/test/integration/targets/lookup_template/files/trim_blocks_false.expected @@ -0,0 +1,4 @@ + +Hello world + +Goodbye diff --git a/test/integration/targets/lookup_template/files/trim_blocks_true.expected b/test/integration/targets/lookup_template/files/trim_blocks_true.expected new file mode 100644 index 0000000000..03acd5d37a --- /dev/null +++ b/test/integration/targets/lookup_template/files/trim_blocks_true.expected @@ -0,0 +1,2 @@ +Hello world +Goodbye diff --git a/test/integration/targets/lookup_template/tasks/main.yml b/test/integration/targets/lookup_template/tasks/main.yml index 9ebdf0c5ac..8c6a9b29c6 100644 --- a/test/integration/targets/lookup_template/tasks/main.yml +++ b/test/integration/targets/lookup_template/tasks/main.yml @@ -32,3 +32,5 @@ - lookup('template', 'dict.j2') is mapping - lookup('template', 'dict.j2', convert_data=True) is mapping - lookup('template', 'dict.j2', convert_data=False) is not mapping + +- include_tasks: trim_blocks.yml diff --git a/test/integration/targets/lookup_template/tasks/trim_blocks.yml b/test/integration/targets/lookup_template/tasks/trim_blocks.yml new file mode 100644 index 0000000000..b82fc0067b --- /dev/null +++ b/test/integration/targets/lookup_template/tasks/trim_blocks.yml @@ -0,0 +1,32 @@ +# VERIFY trim_blocks +- name: Render a template with "trim_blocks" set to False + copy: + content: "{{ lookup('template', 'trim_blocks.j2', trim_blocks=False) }}" + dest: "{{ output_dir }}/trim_blocks_false.templated" + register: trim_blocks_false_result + +- name: Get checksum of known good trim_blocks_false.expected + stat: + path: "{{ role_path }}/files/trim_blocks_false.expected" + register: trim_blocks_false_good + +- name: Verify templated trim_blocks_false matches known good using checksum + assert: + that: + - "trim_blocks_false_result.checksum == trim_blocks_false_good.stat.checksum" + +- name: Render a template with "trim_blocks" set to True + copy: + content: "{{ lookup('template', 'trim_blocks.j2', trim_blocks=True) }}" + dest: "{{ output_dir }}/trim_blocks_true.templated" + register: trim_blocks_true_result + +- name: Get checksum of known good trim_blocks_true.expected + stat: + path: "{{ role_path }}/files/trim_blocks_true.expected" + register: trim_blocks_true_good + +- name: Verify templated trim_blocks_true matches known good using checksum + assert: + that: + - "trim_blocks_true_result.checksum == trim_blocks_true_good.stat.checksum" diff --git a/test/integration/targets/lookup_template/templates/trim_blocks.j2 b/test/integration/targets/lookup_template/templates/trim_blocks.j2 new file mode 100644 index 0000000000..824a0a0345 --- /dev/null +++ b/test/integration/targets/lookup_template/templates/trim_blocks.j2 @@ -0,0 +1,4 @@ +{% if True %} +Hello world +{% endif %} +Goodbye |