tests/ansible: Spec.transport() test.

pull/564/head
David Wilson 6 years ago
parent 10dcbaa493
commit 8fd641c442

@ -1,10 +1,13 @@
# integration/transport_config
# Hosts with twiddled configs that need to be checked somehow.
# tansport()
tc-transport-unset
tc-transport-local ansible_connection=local
# python_path()
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

@ -1,2 +1,2 @@
- include: python_path.yml
- include: transport.yml

@ -8,8 +8,7 @@
hosts: tc-python-path-unset
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/usr/bin/python"]
@ -18,8 +17,7 @@
vars: {mitogen_via: tc-python-path-unset}
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/usr/bin/python"]
@ -32,8 +30,7 @@
- hosts: tc-python-path-hostvar
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: [/hostvar/path/to/python]
@ -42,8 +39,7 @@
vars: {mitogen_via: tc-python-path-hostvar}
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/hostvar/path/to/python"]
@ -56,8 +52,7 @@
- hosts: localhost
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["{{ansible_playbook_python}}"]
@ -66,8 +61,7 @@
vars: {mitogen_via: localhost}
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["{{ansible_playbook_python}}"]
@ -80,8 +74,7 @@
- hosts: tc-python-path-local-unset
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/usr/bin/python"]
@ -90,8 +83,7 @@
vars: {mitogen_via: tc-python-path-local-unset}
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/usr/bin/python"]
@ -104,8 +96,7 @@
- hosts: tc-python-path-local-explicit
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/a/b/c"]
@ -114,8 +105,7 @@
vars: {mitogen_via: tc-python-path-local-explicit}
tasks:
- include: ../_mitogen_only.yml
- mitogen_get_stack:
register: out
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].kwargs.python_path
right: ["/a/b/c"]

@ -0,0 +1,48 @@
# Each case is followed by mitogen_via= case to test hostvars method.
# When no ansible_connection= is set, transport comes via ansible.cfg ("smart"
# is parsed away to either paramiko or ssh).
- name: integration/transport_config/transport.yml
hosts: tc-transport-unset
tasks:
- include: ../_mitogen_only.yml
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].method
right: "ssh"
- hosts: tc-transport-local
vars: {mitogen_via: tc-transport-unset}
tasks:
- include: ../_mitogen_only.yml
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].method
right: "ssh"
- assert_equal:
left: out.result[1].method
right: "local"
# ansible_connection=local
- hosts: tc-transport-local
tasks:
- include: ../_mitogen_only.yml
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].method
right: "local"
- hosts: tc-transport-unset
vars: {mitogen_via: tc-transport-local}
tasks:
- include: ../_mitogen_only.yml
- {mitogen_get_stack: {}, register: out}
- assert_equal:
left: out.result[0].method
right: "local"
- assert_equal:
left: out.result[1].method
right: "ssh"
Loading…
Cancel
Save