issue #536: add tests for each ansible_python_interpreter case.

pull/564/head
David Wilson 5 years ago
parent 86f9572ef7
commit 01faed708d

@ -0,0 +1,10 @@
# integration/transport_config
# Hosts with twiddled configs that need to be checked somehow.
tc-python-path-unset
tc-python-path-hostvar ansible_python_interpreter=/hostvar/path/to/python
# local connections get virtualenv python path
tc-python-path-local-unset ansible_connection=local
tc-python-path-local-explicit ansible_connection=local ansible_python_interpreter=/a/b/c

@ -19,3 +19,4 @@
- include: ssh/all.yml
- include: strategy/all.yml
- include: stub_connections/all.yml
- include: transport_config/all.yml

@ -0,0 +1,7 @@
# Tests for correct selection of connection variables.
This directory is a placeholder for a work-in-progress test set that tries
every combination of the variables extracted via `transport_config.py`.
In the meantime, it has ad-hoc scripts for bugs already encountered.

@ -0,0 +1,51 @@
# related: issue #511, #536
- name: integration/transport_config/python_path.yml
hosts: tc-python-path-unset
# When no ansible_python_interpreter is set, executor/module_common.py
# chooses "/usr/bin/python".
tasks:
- mitogen_get_stack:
register: out
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/usr/bin/python"]
- hosts: tc-python-path-hostvar
tasks:
- mitogen_get_stack:
register: out
- assert_equal:
left: out.result[0].kwargs.python_path
right: [/hostvar/path/to/python]
# Implicit localhost gets ansible_python_interpreter=virtualenv interpreter
- hosts: localhost
tasks:
- mitogen_get_stack:
register: out
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["{{ansible_playbook_python}}"]
# explicit local connections get the same treatment as everything else.
- hosts: tc-python-path-local-unset
tasks:
- mitogen_get_stack:
register: out
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/usr/bin/python"]
- hosts: tc-python-path-local-explicit
tasks:
- mitogen_get_stack:
register: out
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/a/b/c"]
Loading…
Cancel
Save