mirror of https://github.com/ansible/ansible.git
fix delegate_to integration test (#83865)
* the test was previously passing erroneously due to the `timeout` elapsing in CI, and that the `failed` test does not encompass `unreachable`pull/83870/head
parent
2a676ff897
commit
c6a391c8d8
@ -1,18 +1,37 @@
|
|||||||
- name: ensure we can use fact on delegated host for connection info
|
- name: create a dedicated broken host and a working copy of localhost to delegate to
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
tasks:
|
tasks:
|
||||||
- add_host: name=f31 bogus_user=notme ansible_connection=ssh ansible_host=4.2.2.2
|
- add_host:
|
||||||
|
name: busted
|
||||||
|
ansible_connection: ssh
|
||||||
|
ansible_host: localhost
|
||||||
|
ansible_port: 1
|
||||||
|
- add_host:
|
||||||
|
name: delegate_to_local
|
||||||
|
ansible_connection: local
|
||||||
|
ansible_python_interpreter: '{{ ansible_playbook_python }}'
|
||||||
|
|
||||||
- name: if not overriding with delegated host info, will not be unreachable
|
- name: play targets an unreachable host, delegates to a working one
|
||||||
|
hosts: busted
|
||||||
|
gather_facts: no
|
||||||
|
tasks:
|
||||||
|
- name: attempt to connect to a broken host
|
||||||
ping:
|
ping:
|
||||||
timeout: 5
|
timeout: 5 # backstop for a tarpit port or dropped packets
|
||||||
delegate_to: f31
|
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
ignore_unreachable: true
|
ignore_unreachable: true
|
||||||
register: delping
|
register: broken_ping
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- broken_ping is unreachable
|
||||||
|
|
||||||
|
- name: delegate to the valid host
|
||||||
|
ping:
|
||||||
|
delegate_to: delegate_to_local
|
||||||
|
register: delegated_ping
|
||||||
|
|
||||||
- name: ensure that the expected happened
|
- assert:
|
||||||
assert:
|
|
||||||
that:
|
that:
|
||||||
- delping is failed
|
- delegated_ping is success
|
||||||
|
- delegated_ping is reachable
|
||||||
|
Loading…
Reference in New Issue