From 519faa3b3ba4e8c84ebf11ed0a2be8e3d6543c14 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 29 Oct 2018 18:52:13 +0000 Subject: [PATCH] issue #369: add Connection.reset() test. --- tests/ansible/integration/connection/all.yml | 1 + .../ansible/integration/connection/reset.yml | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/ansible/integration/connection/reset.yml diff --git a/tests/ansible/integration/connection/all.yml b/tests/ansible/integration/connection/all.yml index 34e21f61..9c5a2837 100644 --- a/tests/ansible/integration/connection/all.yml +++ b/tests/ansible/integration/connection/all.yml @@ -5,3 +5,4 @@ - import_playbook: exec_command.yml - import_playbook: put_large_file.yml - import_playbook: put_small_file.yml +- import_playbook: reset.yml diff --git a/tests/ansible/integration/connection/reset.yml b/tests/ansible/integration/connection/reset.yml new file mode 100644 index 00000000..56e901b7 --- /dev/null +++ b/tests/ansible/integration/connection/reset.yml @@ -0,0 +1,38 @@ +# issue #369: Connection.reset() should cause destruction of the remote +# interpreter and any children. + +--- + +- name: integration/connection/reset.yml + hosts: test-targets + tasks: + - when: is_mitogen + block: + - custom_python_detect_environment: + register: out + + - custom_python_detect_environment: + become: true + register: out_become + + - meta: reset_connection + + - custom_python_detect_environment: + register: out2 + + - custom_python_detect_environment: + register: out_become2 + + - assert: + that: + # Interpreter PID has changed. + - out.pid != out2.pid + + # SSH PID has changed. + - out.ppid != out2.ppid + + # Interpreter PID has changed. + - out_become.pid != out_become2.pid + + # sudo PID has changed. + - out_become.ppid != out_become2.ppid