From e5776a129a89e406571308c9a78f3bde1f5c3410 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Wed, 11 Apr 2018 17:08:33 -0400 Subject: [PATCH] Add include_import tests for many top level include_tasks (#36531) * Add include_import tests for many top level include_tasks Rename a few test playbooks to make more sense * Use fewer include_tasks due to memory limits in CI --- .../targets/include_import/runme.sh | 22 ++++++++-- .../include_import/tasks/hello/.gitignore | 1 + .../targets/include_import/tasks/hello/keep | 0 .../test_copious_include_tasks.yml | 44 +++++++++++++++++++ .../{nested.yml => test_nested_tasks.yml} | 2 +- ..._recursion.yml => test_role_recursion.yml} | 0 6 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 test/integration/targets/include_import/tasks/hello/.gitignore create mode 100644 test/integration/targets/include_import/tasks/hello/keep create mode 100644 test/integration/targets/include_import/test_copious_include_tasks.yml rename test/integration/targets/include_import/{nested.yml => test_nested_tasks.yml} (75%) rename test/integration/targets/include_import/{test_recursion.yml => test_role_recursion.yml} (100%) diff --git a/test/integration/targets/include_import/runme.sh b/test/integration/targets/include_import/runme.sh index 8b8ce28e23..0b907f6e87 100755 --- a/test/integration/targets/include_import/runme.sh +++ b/test/integration/targets/include_import/runme.sh @@ -4,6 +4,12 @@ set -eux export ANSIBLE_ROLES_PATH=./roles +function gen_task_files() { + for i in $(seq -f '%03g' 1 39); do + echo -e "- name: Hello Message\n debug:\n msg: Task file ${i}" > "tasks/hello/tasks-file-${i}.yml" + done +} + ## Import (static) # Playbook @@ -33,11 +39,19 @@ ANSIBLE_STRATEGY='linear' ansible-playbook role/test_include_role.yml -i ../../i ANSIBLE_STRATEGY='free' ansible-playbook role/test_include_role.yml -i ../../inventory "$@" --skip-tags never -## Recursion +## Max Recursion Depth # https://github.com/ansible/ansible/issues/23609 -ANSIBLE_STRATEGY='linear' ansible-playbook test_recursion.yml -i ../../inventory "$@" --skip-tags never +ANSIBLE_STRATEGY='linear' ansible-playbook test_role_recursion.yml -i ../../inventory "$@" --skip-tags never ## Nested tasks # https://github.com/ansible/ansible/issues/34782 -ANSIBLE_STRATEGY='linear' ansible-playbook nested.yml -i ../../inventory "$@" --skip-tags never -ANSIBLE_STRATEGY='free' ansible-playbook nested.yml -i ../../inventory "$@" --skip-tags never +ANSIBLE_STRATEGY='linear' ansible-playbook test_nested_tasks.yml -i ../../inventory "$@" --skip-tags never +ANSIBLE_STRATEGY='free' ansible-playbook test_nested_tasks.yml -i ../../inventory "$@" --skip-tags never + +## Tons of top level include_tasks +# https://github.com/ansible/ansible/issues/36053 +# Fixed by https://github.com/ansible/ansible/pull/36075 +gen_task_files +ANSIBLE_STRATEGY='linear' ansible-playbook test_copious_include_tasks.yml -i ../../inventory "$@" --skip-tags never +ANSIBLE_STRATEGY='free' ansible-playbook test_copious_include_tasks.yml -i ../../inventory "$@" --skip-tags never +rm -f tasks/hello/*.yml diff --git a/test/integration/targets/include_import/tasks/hello/.gitignore b/test/integration/targets/include_import/tasks/hello/.gitignore new file mode 100644 index 0000000000..b4602e7895 --- /dev/null +++ b/test/integration/targets/include_import/tasks/hello/.gitignore @@ -0,0 +1 @@ +tasks-file-* diff --git a/test/integration/targets/include_import/tasks/hello/keep b/test/integration/targets/include_import/tasks/hello/keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/integration/targets/include_import/test_copious_include_tasks.yml b/test/integration/targets/include_import/test_copious_include_tasks.yml new file mode 100644 index 0000000000..4564c76e66 --- /dev/null +++ b/test/integration/targets/include_import/test_copious_include_tasks.yml @@ -0,0 +1,44 @@ +- name: Test many include_tasks + hosts: testhost + gather_facts: no + + tasks: + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-001.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-002.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-003.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-004.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-005.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-006.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-007.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-008.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-009.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-010.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-011.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-012.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-013.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-014.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-015.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-016.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-017.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-018.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-019.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-020.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-021.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-022.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-023.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-024.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-025.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-026.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-027.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-028.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-029.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-030.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-031.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-032.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-033.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-034.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-035.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-036.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-037.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-038.yml" + - include_tasks: "{{ playbook_dir }}/tasks/hello/tasks-file-039.yml" diff --git a/test/integration/targets/include_import/nested.yml b/test/integration/targets/include_import/test_nested_tasks.yml similarity index 75% rename from test/integration/targets/include_import/nested.yml rename to test/integration/targets/include_import/test_nested_tasks.yml index 9d1d25ebec..7451ec4e86 100644 --- a/test/integration/targets/include_import/nested.yml +++ b/test/integration/targets/include_import/test_nested_tasks.yml @@ -3,4 +3,4 @@ include+meta doesnt mess included files mecanisms hosts: testhost tasks: - - include_tasks: ./tasks/nested/nested.yml + - include_tasks: ./tasks/nested/nested.yml diff --git a/test/integration/targets/include_import/test_recursion.yml b/test/integration/targets/include_import/test_role_recursion.yml similarity index 100% rename from test/integration/targets/include_import/test_recursion.yml rename to test/integration/targets/include_import/test_role_recursion.yml