tests/ansible: Spec.password() test, document interactive pw limitation.
parent
21ad299d7b
commit
d1cadf8ac8
@ -0,0 +1,94 @@
|
||||
# Each case is followed by mitogen_via= case to test hostvars method.
|
||||
|
||||
|
||||
# When no ansible_ssh_pass/ansible_password= is set, password comes via
|
||||
# interactive input.
|
||||
- name: integration/transport_config/password.yml
|
||||
hosts: tc-password-unset
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "" # actually null, but assert_equal limitation
|
||||
|
||||
- hosts: tc-password-unset
|
||||
vars: {mitogen_via: tc-password-explicit-ssh}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "ansi-ssh-pass"
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.password
|
||||
right: ""
|
||||
|
||||
|
||||
# ansible_ssh_user=
|
||||
|
||||
- hosts: tc-password-explicit-ssh
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "ansi-ssh-pass"
|
||||
|
||||
- hosts: tc-password-explicit-ssh
|
||||
vars: {mitogen_via: tc-password-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: ""
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.password
|
||||
right: "ansi-ssh-pass"
|
||||
|
||||
|
||||
# ansible_user=
|
||||
|
||||
- hosts: tc-password-explicit-pass
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "ansi-pass"
|
||||
|
||||
- hosts: tc-password-explicit-pass
|
||||
vars: {mitogen_via: tc-password-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: ""
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.password
|
||||
right: "ansi-pass"
|
||||
|
||||
|
||||
# both; ansible_ssh_user= takes precedence according to play_context.py.
|
||||
|
||||
- hosts: tc-password-explicit-both
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: "c.b.a"
|
||||
|
||||
- hosts: tc-password-explicit-both
|
||||
vars: {mitogen_via: tc-password-unset}
|
||||
tasks:
|
||||
- include: ../_mitogen_only.yml
|
||||
- {mitogen_get_stack: {}, register: out}
|
||||
- assert_equal:
|
||||
left: out.result[0].kwargs.password
|
||||
right: ""
|
||||
- assert_equal:
|
||||
left: out.result[1].kwargs.password
|
||||
right: "c.b.a"
|
Loading…
Reference in New Issue