tests: better regression test for issue #109

pull/192/head
David Wilson 7 years ago
parent 261f4397bb
commit aeeba54d96

@ -13,6 +13,8 @@ import sys
def main():
module = AnsibleModule(argument_spec={})
module.exit_json(
cwd=os.getcwd(),
python_path=sys.path,
pid=os.getpid(),
ppid=os.getppid(),
uid=os.getuid(),

@ -1,11 +1,11 @@
- import_playbook: issue_109.yml
- import_playbook: issue_109__target_has_old_ansible_installed.yml
- import_playbook: issue_113.yml
- import_playbook: issue_118.yml
- import_playbook: issue_122.yml
- import_playbook: issue_131.yml
- import_playbook: issue_140.yml
- import_playbook: issue_152.yml
- import_playbook: issue_152b.yml
- import_playbook: issue_152__local_action_wrong_interpreter.yml
- import_playbook: issue_152__virtualenv_python_fails.yml
- import_playbook: issue_154.yml
- import_playbook: issue_174.yml
- import_playbook: issue_177.yml

@ -0,0 +1,3 @@
# I am a dummy ansible.py, that would cause 'import ansible' to fail to trigger
# the Mitogen module loader prior to issue #109. I don't need to contain
# anything, I just need to exist on PYTHONPATH.

@ -1,5 +0,0 @@
# Reproduction for issue #109.
- hosts: all
roles:
- issue_109

@ -0,0 +1,33 @@
# issue #109: ensure that any 'ansible' module or package on the remote machine
# does not conflict with operation.
- hosts: all
gather_facts: true
become: true
become_user: mitogen__user1
tasks:
- name: regression/issue_109__target_has_old_ansible_installed.yml
assert:
that: true
# Copy the naughty 'ansible' into place.
- copy:
dest: "{{ansible_user_dir}}/ansible.py"
src: ansible.py
# Restart the connection.
- mitogen_shutdown_all:
- custom_python_detect_environment:
register: env
# Verify interpreter config would actually trigger the bug.
- assert:
that:
- env.cwd == ansible_user_dir
- env.python_path.count("") == 1
# Run some new-style modules that 'from ansible.module_utils...'
- stat:
path: /

@ -1,9 +0,0 @@
---
- name: Decrypt SSH-Keys
include_role:
name: issue_109_add_ssh_key
- name: Gather Facts
include_role:
name: issue_109_gather_facts

@ -1,2 +1,2 @@
#!/bin/bash
/bin/true
command true

Loading…
Cancel
Save