summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Davis <6775756+nitzmahone@users.noreply.github.com>2024-08-27 02:54:08 +0200
committerGitHub <noreply@github.com>2024-08-27 02:54:08 +0200
commitc6a391c8d8ce357623f8eb2eb9d7c77d1f36f701 (patch)
tree45470f8c32b38db1fd6afb78c3e9ff7a56d8d6b3
parentcopy, fix permissions and atime on diff partitions (#83824) (diff)
downloadansible-c6a391c8d8ce357623f8eb2eb9d7c77d1f36f701.tar.xz
ansible-c6a391c8d8ce357623f8eb2eb9d7c77d1f36f701.zip
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`
-rw-r--r--test/integration/targets/delegate_to/delegate_with_fact_from_delegate_host.yml37
1 files changed, 28 insertions, 9 deletions
diff --git a/test/integration/targets/delegate_to/delegate_with_fact_from_delegate_host.yml b/test/integration/targets/delegate_to/delegate_with_fact_from_delegate_host.yml
index 1670398423..97b0d7d08c 100644
--- a/test/integration/targets/delegate_to/delegate_with_fact_from_delegate_host.yml
+++ b/test/integration/targets/delegate_to/delegate_with_fact_from_delegate_host.yml
@@ -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
gather_facts: no
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:
- timeout: 5
- delegate_to: f31
+ timeout: 5 # backstop for a tarpit port or dropped packets
ignore_errors: 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:
- - delping is failed
+ - delegated_ping is success
+ - delegated_ping is reachable