From 05d98e5b499bed231edda8826d71bd719cc7d831 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Tue, 14 May 2024 10:53:30 +0100 Subject: [PATCH] tests: Speed up ssh timeout tests --- docs/ansible_detailed.rst | 9 +++++++++ tests/ansible/integration/ssh/timeouts.yml | 6 ++++++ tests/ansible/integration/ssh/variables.yml | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/docs/ansible_detailed.rst b/docs/ansible_detailed.rst index b395bc25..e6f7b42c 100644 --- a/docs/ansible_detailed.rst +++ b/docs/ansible_detailed.rst @@ -247,6 +247,15 @@ Noteworthy Differences part of the core library, and should therefore be straightforward to fix as part of 0.2.x. +* Connection and become timeouts are applied differently. Mitogen may consider + a connection to have timed out, when Ansible would have waited longer or + indefinately. For example if SSH authentication completes within the + timeout, but execution of login scripts exceeds it - then Mitogen will + consider the task to have timed out and that host to have failed. + +.. + tests/ansible/integration/ssh/timeouts.yml covers (some of) this behaviour. + .. * SSH and ``become`` are treated distinctly when applying timeouts, and timeouts apply up to the point when the new interpreter is ready to accept diff --git a/tests/ansible/integration/ssh/timeouts.yml b/tests/ansible/integration/ssh/timeouts.yml index a7691bc3..2b14b9f3 100644 --- a/tests/ansible/integration/ssh/timeouts.yml +++ b/tests/ansible/integration/ssh/timeouts.yml @@ -1,7 +1,12 @@ # Ensure 'ssh' connections time out correctly. +# mitogen__slow_user performs a long sleep in ~/.profile. +# Mitogen counts this time towards the connection timeout. Ansible doesn't. +# ansible_python_interpreter=python3000 is an optimisation, to avoid waiting +# on the timeout multiple times (e.g. interpreter discovery). - name: integration/ssh/timeouts.yml hosts: test-targets + gather_facts: false tasks: - include_tasks: ../_mitogen_only.yml @@ -17,6 +22,7 @@ test-targets -m custom_python_detect_environment -e ansible_user=mitogen__slow_user -e ansible_password=slow_user_password + -e ansible_python_interpreter=python3000 args: chdir: ../.. register: out diff --git a/tests/ansible/integration/ssh/variables.yml b/tests/ansible/integration/ssh/variables.yml index f51509db..f9c0f911 100644 --- a/tests/ansible/integration/ssh/variables.yml +++ b/tests/ansible/integration/ssh/variables.yml @@ -43,6 +43,7 @@ test-targets -e ansible_ssh_user=mitogen__has_sudo -e ansible_ssh_pass=wrong_password + -e ansible_python_interpreter=python3000 args: chdir: ../.. register: out @@ -82,6 +83,7 @@ test-targets -e ansible_user=mitogen__has_sudo -e ansible_ssh_pass=wrong_password + -e ansible_python_interpreter=python3000 args: chdir: ../.. register: out @@ -121,6 +123,7 @@ test-targets -e ansible_user=mitogen__has_sudo -e ansible_password=wrong_password + -e ansible_python_interpreter=python3000 args: chdir: ../.. register: out @@ -165,6 +168,7 @@ test-targets -e ansible_user=mitogen__has_sudo -e ansible_ssh_private_key_file=/dev/null + -e ansible_python_interpreter=python3000 args: chdir: ../.. register: out