diff options
Diffstat (limited to 'test/integration/targets/lookup_template')
7 files changed, 41 insertions, 0 deletions
diff --git a/test/integration/targets/lookup_template/aliases b/test/integration/targets/lookup_template/aliases new file mode 100644 index 0000000..b598321 --- /dev/null +++ b/test/integration/targets/lookup_template/aliases @@ -0,0 +1 @@ +shippable/posix/group3 diff --git a/test/integration/targets/lookup_template/tasks/main.yml b/test/integration/targets/lookup_template/tasks/main.yml new file mode 100644 index 0000000..9ebdf0c --- /dev/null +++ b/test/integration/targets/lookup_template/tasks/main.yml @@ -0,0 +1,34 @@ +# ref #18526 +- name: Test that we have a proper jinja search path in template lookup + set_fact: + hello_world: "{{ lookup('template', 'hello.txt') }}" + +- assert: + that: + - "hello_world|trim == 'Hello world!'" + + +- name: Test that we have a proper jinja search path in template lookup with different variable start and end string + vars: + my_var: world + set_fact: + hello_world_string: "{{ lookup('template', 'hello_string.txt', variable_start_string='[%', variable_end_string='%]') }}" + +- assert: + that: + - "hello_world_string|trim == 'Hello world!'" + +- name: Test that we have a proper jinja search path in template lookup with different comment start and end string + set_fact: + hello_world_comment: "{{ lookup('template', 'hello_comment.txt', comment_start_string='[#', comment_end_string='#]') }}" + +- assert: + that: + - "hello_world_comment|trim == 'Hello world!'" + +# 77004 +- assert: + that: + - 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 diff --git a/test/integration/targets/lookup_template/templates/dict.j2 b/test/integration/targets/lookup_template/templates/dict.j2 new file mode 100644 index 0000000..0439155 --- /dev/null +++ b/test/integration/targets/lookup_template/templates/dict.j2 @@ -0,0 +1 @@ +{"foo": "{{ 'bar' }}"} diff --git a/test/integration/targets/lookup_template/templates/hello.txt b/test/integration/targets/lookup_template/templates/hello.txt new file mode 100644 index 0000000..be15a4f --- /dev/null +++ b/test/integration/targets/lookup_template/templates/hello.txt @@ -0,0 +1 @@ +Hello {% include 'world.txt' %}! diff --git a/test/integration/targets/lookup_template/templates/hello_comment.txt b/test/integration/targets/lookup_template/templates/hello_comment.txt new file mode 100644 index 0000000..92af4b3 --- /dev/null +++ b/test/integration/targets/lookup_template/templates/hello_comment.txt @@ -0,0 +1,2 @@ +[# Comment #] +Hello world! diff --git a/test/integration/targets/lookup_template/templates/hello_string.txt b/test/integration/targets/lookup_template/templates/hello_string.txt new file mode 100644 index 0000000..75199af --- /dev/null +++ b/test/integration/targets/lookup_template/templates/hello_string.txt @@ -0,0 +1 @@ +Hello [% my_var %]! diff --git a/test/integration/targets/lookup_template/templates/world.txt b/test/integration/targets/lookup_template/templates/world.txt new file mode 100644 index 0000000..cc628cc --- /dev/null +++ b/test/integration/targets/lookup_template/templates/world.txt @@ -0,0 +1 @@ +world |