From d827bdb848a7a8795b7d01785f3f5579936234b3 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 18 Apr 2018 15:30:31 +0100 Subject: [PATCH] tests: fixes to get regression/ running under vanilla Ansible --- .travis/ansible_tests.sh | 6 +++--- tests/ansible/lib/action/mitogen_shutdown_all.py | 5 +++++ .../ansible/lib/modules/custom_python_detect_environment.py | 1 + .../issue_109__target_has_old_ansible_installed.yml | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis/ansible_tests.sh b/.travis/ansible_tests.sh index 0b207c2f..0d6df4ae 100755 --- a/.travis/ansible_tests.sh +++ b/.travis/ansible_tests.sh @@ -1,5 +1,5 @@ #!/bin/bash -ex -# Run tests/ansible/integration/all.yml under Ansible and Ansible-Mitogen +# Run tests/ansible/all.yml under Ansible and Ansible-Mitogen TRAVIS_BUILD_DIR="${TRAVIS_BUILD_DIR:-`pwd`}" TMPDIR="/tmp/ansible-tests-$$" @@ -58,7 +58,7 @@ echo travis_fold:end:job_setup echo travis_fold:start:mitogen_linear /usr/bin/time ./mitogen_ansible_playbook.sh \ - integration/all.yml \ + all.yml \ -vvv \ -i "${TMPDIR}/hosts" echo travis_fold:end:mitogen_linear @@ -66,7 +66,7 @@ echo travis_fold:end:mitogen_linear echo travis_fold:start:vanilla_ansible /usr/bin/time ./run_ansible_playbook.sh \ - integration/all.yml \ + all.yml \ -vvv \ -i "${TMPDIR}/hosts" echo travis_fold:end:vanilla_ansible diff --git a/tests/ansible/lib/action/mitogen_shutdown_all.py b/tests/ansible/lib/action/mitogen_shutdown_all.py index 7375bc30..65be8b20 100644 --- a/tests/ansible/lib/action/mitogen_shutdown_all.py +++ b/tests/ansible/lib/action/mitogen_shutdown_all.py @@ -15,6 +15,11 @@ from ansible.plugins.action import ActionBase class ActionModule(ActionBase): def run(self, tmp=None, task_vars=None): + if not type(self._connection).__module__.startswith('ansible_mitogen'): + return { + 'changed': False + } + self._connection._connect() return { 'changed': True, diff --git a/tests/ansible/lib/modules/custom_python_detect_environment.py b/tests/ansible/lib/modules/custom_python_detect_environment.py index 4387fd9e..e289744f 100644 --- a/tests/ansible/lib/modules/custom_python_detect_environment.py +++ b/tests/ansible/lib/modules/custom_python_detect_environment.py @@ -13,6 +13,7 @@ import sys def main(): module = AnsibleModule(argument_spec={}) module.exit_json( + argv=sys.argv, env=dict(os.environ), cwd=os.getcwd(), python_path=sys.path, diff --git a/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml b/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml index 3a00f6e1..7c2eef46 100644 --- a/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml +++ b/tests/ansible/regression/issue_109__target_has_old_ansible_installed.yml @@ -24,7 +24,7 @@ - assert: that: - env.cwd == ansible_user_dir - - env.python_path.count("") == 1 + - (not env.mitogen_loaded) or (env.python_path.count("") == 1) # Run some new-style modules that 'from ansible.module_utils...' - stat: