From f91d961cb4d5fc3f4362b35495cd988375ddc278 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Thu, 26 Apr 2018 12:24:43 -0700 Subject: [PATCH] Add tests for template with non-ascii filenames This is a test in response to #27262 but I could not provoke the error so it only shows that the current code is working with non-ascii filenames in this case. It doesn't show whether there's some other bug somewhere. --- .../targets/template/tasks/main.yml | 18 ++++++++++++++++++ .../targets/template/templates/café.j2 | 1 + 2 files changed, 19 insertions(+) create mode 100644 test/integration/targets/template/templates/café.j2 diff --git a/test/integration/targets/template/tasks/main.yml b/test/integration/targets/template/tasks/main.yml index ee04f0f3c27..7e34852afab 100644 --- a/test/integration/targets/template/tasks/main.yml +++ b/test/integration/targets/template/tasks/main.yml @@ -51,6 +51,24 @@ that: - "template_result.changed == true" +# Basic template with non-ascii names +- name: Check that non-ascii source and dest work + template: + src: 'café.j2' + dest: '{{ output_dir }}/café.txt' + register: template_results + +- name: Check that the resulting file exists + stat: + path: '{{ output_dir }}/café.txt' + register: stat_results + +- name: Check that template created the right file + assert: + that: + - 'template_results is changed' + - 'stat_results.stat["exists"]' + # test for import with context on jinja-2.9 See https://github.com/ansible/ansible/issues/20494 - name: fill in a template using import with context ala issue 20494 template: src=import_with_context.j2 dest={{output_dir}}/import_with_context.templated mode=0644 diff --git a/test/integration/targets/template/templates/café.j2 b/test/integration/targets/template/templates/café.j2 new file mode 100644 index 00000000000..ef7e08e741c --- /dev/null +++ b/test/integration/targets/template/templates/café.j2 @@ -0,0 +1 @@ +{{ ansible_managed }}