diff --git a/tests/ansible/integration/async/all.yml b/tests/ansible/integration/async/all.yml index b295b526..bae2c308 100644 --- a/tests/ansible/integration/async/all.yml +++ b/tests/ansible/integration/async/all.yml @@ -1,5 +1,6 @@ - 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_two_simultaneous_jobs.yml diff --git a/tests/ansible/integration/async/runner_new_process.yml b/tests/ansible/integration/async/runner_new_process.yml new file mode 100644 index 00000000..7b0bf628 --- /dev/null +++ b/tests/ansible/integration/async/runner_new_process.yml @@ -0,0 +1,54 @@ +# Verify async jobs run in a new process. + +- name: integration/async/runner_new_process.yml + hosts: test-targets + any_errors_fatal: true + tasks: + + - name: get process ID. + custom_python_detect_environment: + register: sync_proc1 + + - name: get process ID again. + custom_python_detect_environment: + register: sync_proc2 + + - assert: + that: + - sync_proc1.pid == sync_proc2.pid + when: is_mitogen + + - name: get async process ID. + custom_python_detect_environment: + register: async_proc1 + async: 1000 + poll: 0 + + - name: busy-poll up to 100000 times + async_status: + jid: "{{async_proc1.ansible_job_id}}" + register: async_result1 + until: async_result1.finished + retries: 100000 + delay: 0 + + - name: get async process ID again. + custom_python_detect_environment: + register: async_proc2 + async: 1000 + poll: 0 + + - name: busy-poll up to 100000 times + async_status: + jid: "{{async_proc2.ansible_job_id}}" + register: async_result2 + until: async_result2.finished + retries: 100000 + delay: 0 + + - assert: + that: + - sync_proc1.pid == sync_proc2.pid + - async_result1.pid != sync_proc1.pid + - async_result1.pid != async_result2.pid + when: is_mitogen diff --git a/tests/ansible/integration/async/runner_one_job.yml b/tests/ansible/integration/async/runner_one_job.yml index 989a7cda..04ffc5ea 100644 --- a/tests/ansible/integration/async/runner_one_job.yml +++ b/tests/ansible/integration/async/runner_one_job.yml @@ -6,56 +6,6 @@ any_errors_fatal: true tasks: - # Verify async jobs run in a new process. - - - name: get process ID. - custom_python_detect_environment: - register: sync_proc1 - - - name: get process ID again. - custom_python_detect_environment: - register: sync_proc2 - - - assert: - that: - - sync_proc1.pid == sync_proc2.pid - when: is_mitogen - - - name: get async process ID. - custom_python_detect_environment: - register: async_proc1 - async: 1000 - poll: 0 - - - name: busy-poll up to 100000 times - async_status: - jid: "{{async_proc1.ansible_job_id}}" - register: async_result1 - until: async_result1.finished - retries: 100000 - delay: 0 - - - name: get async process ID again. - custom_python_detect_environment: - register: async_proc2 - async: 1000 - poll: 0 - - - name: busy-poll up to 100000 times - async_status: - jid: "{{async_proc2.ansible_job_id}}" - register: async_result2 - until: async_result2.finished - retries: 100000 - delay: 0 - - - assert: - that: - - sync_proc1.pid == sync_proc2.pid - - async_result1.pid != sync_proc1.pid - - async_result1.pid != async_result2.pid - when: is_mitogen - # Verify output of a single async job. - name: start 2 second op