From b67e4e118e95ddd37ac591f272fa6996bc335333 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 27 Jan 2019 01:33:44 +0000 Subject: [PATCH] issue #477: update forking_correct_parent for subprocess isolation --- .../runner/forking_correct_parent.yml | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/ansible/integration/runner/forking_correct_parent.yml b/tests/ansible/integration/runner/forking_correct_parent.yml index e8207676..c70db4e3 100644 --- a/tests/ansible/integration/runner/forking_correct_parent.yml +++ b/tests/ansible/integration/runner/forking_correct_parent.yml @@ -5,7 +5,17 @@ tasks: # Verify mitogen_task_isolation=fork forks from "virginal fork parent", not - # shared interpreter. + # shared interpreter, but only if forking is enabled (e.g. that's never true + # on Python 2.4). + + - mitogen_action_script: + script: | + self._connection._connect() + result['uses_fork'] = ( + self._connection.init_child_result['fork_context'] is not None + ) + register: forkmode + when: is_mitogen - name: get regular process ID. custom_python_detect_environment: @@ -22,5 +32,12 @@ - assert: that: - fork_proc.pid != regular_proc.pid - - fork_proc.ppid != regular_proc.pid when: is_mitogen + + - assert: + that: fork_proc.ppid != regular_proc.pid + when: is_mitogen and forkmode.uses_fork + + - assert: + that: fork_proc.ppid == regular_proc.pid + when: is_mitogen and not forkmode.uses_fork