Add regression tests for the new connection logic.

Co-authored-by: Alex Willmer <alex@moreati.org.uk>
Co-authored-by: Mark Farrell <mark.a.farrell@team.telstra.com>
pull/1215/head
Jarl Gullberg 12 months ago
parent 8ebeaffaad
commit 211079f130
No known key found for this signature in database
GPG Key ID: FBB69BD7CAE095A0

@ -13,6 +13,7 @@
- import_playbook: issue_591__setuptools_cwd_crash.yml
- import_playbook: issue_615__streaming_transfer.yml
- import_playbook: issue_655__wait_for_connection_error.yml
- import_playbook: issue_766__get_with_context.yml
- import_playbook: issue_776__load_plugins_called_twice.yml
- import_playbook: issue_952__ask_become_pass.yml
- import_playbook: issue_1066__add_host__host_key_checking.yml

@ -11,7 +11,10 @@
tasks:
- meta: end_play
when:
# Podman versions available in Homebrew have dropped macOS 12 support.
# Podman versions available in Homebrew require macOS 13+ (Ventura).
# https://formulae.brew.sh/formula/podman
# See also
# - issue_766__get_with_context.yml
- ansible_facts.system == 'Darwin'
- ansible_facts.distribution_version is version('13.0', '<', strict=True)

@ -0,0 +1,64 @@
# https://github.com/mitogen-hq/mitogen/issues/776
---
- name: regression/issue_766__get_with_context.yml
hosts: localhost
# Gather facts to use *and* to trigger any "could not recover task_vars" error
# https://github.com/mitogen-hq/mitogen/pull/1215#issuecomment-2596421111
gather_facts: true
vars:
netconf_container_image: ghcr.io/mitogen-hq/sysrepo-netopeer2:latest
netconf_container_name: sysprep
netconf_container_port: 8030
tasks:
- meta: end_play
when:
# Podman can be installed on macOS, but authenticating to gchr.io isn't
# worth the trouble right now.
# See also
# - issue_655__wait_for_connection_error.yml
- ansible_facts.system == 'Darwin'
- meta: end_play
when:
# A failure during the ansible.netcommon.netconf_get task, when run
# with Ansible 4 (ansible-core 2.11) & associated collections.
# ansible.module_utils.connection.ConnectionError: Method not found
# https://github.com/mitogen-hq/mitogen/actions/runs/12854359099/job/35838635886
- ansible_version.full is version('2.11', '>=', strict=True)
- ansible_version.full is version('2.12', '<', strict=True)
- block:
- name: Start container
command:
cmd: >-
podman run
--name "{{ netconf_container_name }}"
--detach
--rm
--publish "{{ netconf_container_port }}:830"
"{{ netconf_container_image }}"
changed_when: true
- name: Wait for container
# TODO robust condition. wait_for + search_regex? wait_for_connection?
wait_for:
timeout: 5
- name: Get running configuration and state data
vars:
ansible_connection: netconf
ansible_user: netconf
ansible_password: netconf
ansible_port: "{{ netconf_container_port }}"
ansible_host_key_checking: false
ansible_python_interpreter: "{{ ansible_playbook_python }}"
ansible.netcommon.netconf_get:
always:
- name: Cleanup container
command:
cmd: podman stop "{{ netconf_container_name }}"
changed_when: true
tags:
- issue_766

@ -1,7 +1,13 @@
paramiko==2.3.2 # Last 2.6-compat version.
paramiko==2.12.0; python_version <= '2.7'
paramiko==3.5.0; python_version >= '3.6'
# Incompatible with pip >= 72, due to removal of `setup.py test`:
# ModuleNotFoundError: No module named 'setuptools.command.test'
# https://github.com/pypa/setuptools/issues/4519
hdrhistogram==0.6.1
ncclient==0.6.13; python_version <= '2.7'
ncclient==0.6.16; python_version > '2.7'
PyYAML==3.11; python_version < '2.7'
PyYAML==5.3.1; python_version >= '2.7' # Latest release (Jan 2021)

Loading…
Cancel
Save