From b254051416a9c9e468804d0ddf10578f2ab347da Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 27 Jan 2019 19:29:16 +0000 Subject: [PATCH] ansible: add test to ensure UNIX socket is cleaned on exit; closes #488. --- tests/ansible/integration/all.yml | 1 + tests/ansible/integration/process/all.yml | 1 + .../process/unix_socket_cleanup.yml | 28 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 tests/ansible/integration/process/all.yml create mode 100644 tests/ansible/integration/process/unix_socket_cleanup.yml diff --git a/tests/ansible/integration/all.yml b/tests/ansible/integration/all.yml index 3a149d6d..bd68b4ab 100644 --- a/tests/ansible/integration/all.yml +++ b/tests/ansible/integration/all.yml @@ -14,6 +14,7 @@ - include: local/all.yml - include: module_utils/all.yml - include: playbook_semantics/all.yml +- include: process/all.yml - include: runner/all.yml - include: ssh/all.yml - include: strategy/all.yml diff --git a/tests/ansible/integration/process/all.yml b/tests/ansible/integration/process/all.yml new file mode 100644 index 00000000..a309113a --- /dev/null +++ b/tests/ansible/integration/process/all.yml @@ -0,0 +1 @@ +- include: "unix_socket_cleanup.yml" diff --git a/tests/ansible/integration/process/unix_socket_cleanup.yml b/tests/ansible/integration/process/unix_socket_cleanup.yml new file mode 100644 index 00000000..11a0efe1 --- /dev/null +++ b/tests/ansible/integration/process/unix_socket_cleanup.yml @@ -0,0 +1,28 @@ + +- hosts: test-targets[0] + tasks: + - mitogen_action_script: + script: | + import glob + result['sockets'] = glob.glob('/tmp/mitogen_unix*.sock') + register: socks + + - shell: > + ANSIBLE_STRATEGY=mitogen_linear + ANSIBLE_SSH_ARGS="" + ansible -m shell -c local -a whoami -i "{{MITOGEN_INVENTORY_FILE}}" test-targets + args: + chdir: ../.. + register: out + connection: local + when: is_mitogen + + - mitogen_action_script: + script: | + import glob + result['sockets'] = glob.glob('/tmp/mitogen_unix*.sock') + register: socks2 + + - assert_equal: + left: socks + right: socks2