diff --git a/tests/ansible/integration/async/all.yml b/tests/ansible/integration/async/all.yml index 17969ead..61d2d35c 100644 --- a/tests/ansible/integration/async/all.yml +++ b/tests/ansible/integration/async/all.yml @@ -1,8 +1,9 @@ +- import_playbook: multiple_items_loop.yml - import_playbook: result_binary_producing_json.yml - import_playbook: result_binary_producing_junk.yml - import_playbook: result_shell_echo_hi.yml - import_playbook: runner_new_process.yml - import_playbook: runner_one_job.yml - import_playbook: runner_timeout_then_polling.yml -- import_playbook: runner_with_polling_and_timeout.yml - import_playbook: runner_two_simultaneous_jobs.yml +- import_playbook: runner_with_polling_and_timeout.yml diff --git a/tests/ansible/integration/async/multiple_items_loop.yml b/tests/ansible/integration/async/multiple_items_loop.yml new file mode 100644 index 00000000..9a9b1192 --- /dev/null +++ b/tests/ansible/integration/async/multiple_items_loop.yml @@ -0,0 +1,36 @@ +# issue #414: verify behaviour of async tasks created in a loop. + +- name: integration/async/multiple_items_loop.yml + hosts: test-targets + any_errors_fatal: true + tasks: + + - name: start long running ops + become: true + shell: "{{item}}" + async: 15 + poll: 0 + register: jobs + with_items: + - "sleep 3; echo hi-from-job-1" + - "sleep 5; echo hi-from-job-2" + + - name: Ensure static files are collected and compressed + async_status: + jid: "{{ item.ansible_job_id }}" + become: yes + register: out + until: out.finished + retries: 30 + with_items: + - "{{ jobs.results }}" + + - assert: + that: + - out.results[0].stdout == 'hi-from-job-1' + - out.results[0].rc == 0 + - out.results[0].delta > '0:00:03' + + - out.results[1].stdout == 'hi-from-job-2' + - out.results[1].rc == 0 + - out.results[1].delta > '0:00:05'