Skip to content

Commit 013137c

Browse files
committed
WIP
1 parent d654239 commit 013137c

11 files changed

Lines changed: 104 additions & 202 deletions

File tree

.github/workflows/tests.yml

Lines changed: 2 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -15,75 +15,6 @@ on:
1515
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
1616
# https://github.com/actions/runner-images/blob/main/README.md#software-and-image-support
1717
jobs:
18-
u2204:
19-
name: u2204 ${{ matrix.tox_env }}
20-
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
21-
runs-on: ubuntu-22.04
22-
timeout-minutes: 25
23-
24-
strategy:
25-
fail-fast: false
26-
matrix:
27-
include:
28-
- tox_env: py27-m_ans-ans2.10
29-
- tox_env: py27-m_ans-ans4
30-
31-
- tox_env: py36-m_ans-ans2.10
32-
- tox_env: py36-m_ans-ans4
33-
34-
- tox_env: py27-m_mtg
35-
- tox_env: py36-m_mtg
36-
37-
steps:
38-
- uses: actions/checkout@v6
39-
- uses: docker/login-action@v4
40-
with:
41-
registry: ghcr.io
42-
username: ${{ github.actor }}
43-
password: ${{ secrets.GITHUB_TOKEN }}
44-
- run: .ci/show_python_versions
45-
- run: .ci/setup_ssh_key_mitogen__has_sudo_pubkey
46-
- run: .ci/setup_sudoers_defaults
47-
if: ${{ contains(matrix.tox_env, 'm_mtg') }}
48-
- name: Install deps
49-
id: install-deps
50-
run: |
51-
set -o errexit -o nounset -o pipefail
52-
source .ci/bash_functions
53-
PYTHON="$(toxenv-python '${{ matrix.tox_env }}')"
54-
55-
sudo apt-get update
56-
57-
if [[ $PYTHON == "python2.7" ]]; then
58-
sudo apt install -y python2-dev sshpass virtualenv
59-
curl "https://bootstrap.pypa.io/pip/2.7/get-pip.py" --output "get-pip.py"
60-
"$PYTHON" get-pip.py --user --no-python-version-warning
61-
# Avoid Python 2.x pip masking system pip
62-
rm -f ~/.local/bin/{easy_install,pip,wheel}
63-
elif [[ $PYTHON == "python3.6" ]]; then
64-
sudo apt install -y gcc-10 make libbz2-dev liblzma-dev libreadline-dev libsqlite3-dev libssl-dev sshpass virtualenv zlib1g-dev
65-
curl --fail --silent --show-error --location https://pyenv.run | bash
66-
CC=gcc-10 ~/.pyenv/bin/pyenv install --force 3.6
67-
PYTHON="$HOME/.pyenv/versions/3.6.15/bin/python3.6"
68-
fi
69-
70-
"$PYTHON" -m pip install -r "tests/requirements-tox.txt"
71-
echo "python=$PYTHON" >> $GITHUB_OUTPUT
72-
- name: Create environments
73-
run: |
74-
set -o errexit -o nounset -o pipefail
75-
PYTHON="${{ steps.install-deps.outputs.python }}"
76-
"$PYTHON" -m tox --notest -e "${{ matrix.tox_env }}"
77-
- name: Run tests
78-
env:
79-
GITHUB_ACTOR: ${{ github.actor }}
80-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81-
run: |
82-
set -o errexit -o nounset -o pipefail
83-
PYTHON="${{ steps.install-deps.outputs.python }}"
84-
85-
"$PYTHON" -m tox -e "${{ matrix.tox_env }}"
86-
8718
u2404:
8819
name: u2404 ${{ matrix.tox_env }}
8920
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
@@ -94,35 +25,7 @@ jobs:
9425
fail-fast: false
9526
matrix:
9627
include:
97-
- tox_env: py311-m_ans-ans2.10
98-
python_version: '3.11'
99-
- tox_env: py311-m_ans-ans3
100-
python_version: '3.11'
101-
- tox_env: py311-m_ans-ans4
102-
python_version: '3.11'
103-
- tox_env: py311-m_ans-ans5
104-
python_version: '3.11'
105-
- tox_env: py313-m_ans-ans6
106-
python_version: '3.13'
107-
- tox_env: py313-m_ans-ans7
108-
python_version: '3.13'
109-
- tox_env: py313-m_ans-ans8
110-
python_version: '3.13'
111-
- tox_env: py314-m_ans-ans9
112-
python_version: '3.14'
113-
- tox_env: py314-m_ans-ans10
114-
python_version: '3.14'
115-
- tox_env: py314-m_ans-ans11
116-
python_version: '3.14'
117-
- tox_env: py314-m_ans-ans12
118-
python_version: '3.14'
119-
- tox_env: py314-m_ans-ans13
120-
python_version: '3.14'
121-
122-
- tox_env: py314-m_ans-ans13-s_lin
123-
python_version: '3.14'
124-
125-
- tox_env: py314-m_mtg
28+
- tox_env: py314-m_ans-ans14-s_lin
12629
python_version: '3.14'
12730

12831
steps:
@@ -179,12 +82,7 @@ jobs:
17982
fail-fast: false
18083
matrix:
18184
include:
182-
- tox_env: py314-m_lcl-ans13
183-
python_version: '3.14'
184-
- tox_env: py314-m_lcl-ans13-s_lin
185-
python_version: '3.14'
186-
187-
- tox_env: py314-m_mtg
85+
- tox_env: py314-m_lcl-ans14-s_lin
18886
python_version: '3.14'
18987

19088
steps:
@@ -229,7 +127,6 @@ jobs:
229127
check:
230128
if: always()
231129
needs:
232-
- u2204
233130
- u2404
234131
- macos
235132
runs-on: ubuntu-latest

tests/ansible/integration/async/result_shell_echo_hi.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
tasks:
66

77
- name: Async shell
8+
vars:
9+
# Ansible >= 14 (ansible-core >= 2.21) omits the "invocation" key by
10+
# default, https://github.com/ansible/ansible/pull/86771
11+
ansible_inject_invocation: true
812
shell: echo hi; echo there >&2
913
async: 100
1014
poll: 0
@@ -18,14 +22,17 @@
1822
src: "{{ansible_user_dir}}/.ansible_async/{{job.ansible_job_id}}"
1923
register: result
2024

21-
#- debug: msg="{{result.content|b64decode|from_json}}"
25+
- debug: {var: job}
26+
- debug: {var: result}
27+
- debug: {msg: "{{ result.content | b64decode | from_json }}"}
2228

2329
- assert:
2430
that:
2531
- async_out.changed == True
2632
- async_out.cmd == "echo hi; echo there >&2"
2733
- 'async_out.delta.startswith("0:00:")'
2834
- async_out.end.startswith("20")
35+
- async_out.invocation is defined
2936
- async_out.invocation.module_args._raw_params == "echo hi; echo there >&2"
3037
- async_out.invocation.module_args._uses_shell == True
3138
- async_out.invocation.module_args.chdir == None

tests/ansible/integration/async/runner_with_polling_and_timeout.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
that:
1818
- job1.changed == False
1919
- job1.failed == True
20-
- |
21-
job1.msg == "async task did not complete within the requested time" or
22-
job1.msg == "async task did not complete within the requested time - 1s" or
23-
job1.msg == "Job reached maximum time limit of 1 seconds."
20+
- job1.msg == "async task did not complete within the requested time - 1s"
21+
or (
22+
ansible_version_major_minor is version('2.21', '>=', strict=True)
23+
and job1.msg == "async task produced unparsable results"
24+
)
2425
fail_msg: |
2526
job1={{ job1 }}
2627
tags:
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
- import_playbook: complex_args.yml
2-
- import_playbook: ansible_2_8_tests.yml
2+
- import_playbook: auto.yml
3+
- import_playbook: auto_legacy.yml
4+
- import_playbook: auto_legacy_silent.yml

tests/ansible/integration/interpreter_discovery/ansible_2_8_tests.yml renamed to tests/ansible/integration/interpreter_discovery/auto.yml

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# ripped and ported from https://github.com/ansible/ansible/pull/50163/files, when interpreter discovery was added to ansible
2-
---
3-
- name: integration/interpreter_discovery/ansible_2_8_tests.yml, baseline
2+
- name: integration/interpreter_discovery/auto.yml, linear
43
hosts: test-targets
54
strategy: linear
65
tasks:
@@ -12,7 +11,7 @@
1211
register: linear_auto_result
1312

1413

15-
- name: integration/interpreter_discovery/ansible_2_8_tests.yml
14+
- name: integration/interpreter_discovery/auto.yml
1615
hosts: test-targets
1716
gather_facts: true
1817
tasks:
@@ -69,48 +68,6 @@
6968
or not (echoout.running_python.sys.platform == "darwin"
7069
and echoout.running_python.platform.release.major == 20)
7170

72-
73-
- name: test that auto_legacy gives a dep warning when /usr/bin/python present but != auto result
74-
block:
75-
- name: clear facts to force interpreter discovery to run
76-
meta: clear_facts
77-
78-
- name: trigger discovery with auto_legacy
79-
vars:
80-
ansible_python_interpreter: auto_legacy
81-
ping:
82-
register: legacy
83-
84-
- name: check for dep warning (only on platforms where auto result is not /usr/bin/python and legacy is) for ansible 2.8-2.11
85-
# from ansible 2.12 on this changed
86-
# - https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_5.html#python-interpreter-discovery
87-
# - https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html
88-
# default discovery method is now auto and will default to python3
89-
# and the message changed from a deprecation warning to a real warning that can not be suppressed by
90-
# using deprecation_warnings=False
91-
assert:
92-
that:
93-
- legacy.deprecations | default([]) | length > 0
94-
fail_msg: |
95-
legacy={{ legacy }}
96-
# only check for a dep warning if legacy returned /usr/bin/python and auto didn't
97-
when:
98-
- legacy.ansible_facts.discovered_interpreter_python == '/usr/bin/python'
99-
- auto_out.ansible_facts.discovered_interpreter_python != '/usr/bin/python'
100-
- ansible_version_major_minor is version('2.12', '<', strict=True)
101-
102-
- name: check for warning (only on platforms where auto result is not /usr/bin/python and legacy is) from ansible 2.12 on
103-
assert:
104-
that:
105-
- legacy.warnings | default([]) | length > 0
106-
fail_msg: |
107-
legacy={{ legacy }}
108-
# only check for a warning if legacy returned /usr/bin/python and auto didn't
109-
when:
110-
- legacy.ansible_facts.discovered_interpreter_python == '/usr/bin/python'
111-
- auto_out.ansible_facts.discovered_interpreter_python != '/usr/bin/python'
112-
- ansible_version_major_minor is version('2.12', '>=', strict=True)
113-
11471
- name: test that auto_silent never warns and got the same answer as auto
11572
block:
11673
- name: clear facts to force interpreter discovery to run
@@ -129,25 +86,6 @@
12986
fail_msg: |
13087
auto_silent_out={{ auto_silent_out }}
13188
132-
133-
- name: test that auto_legacy_silent never warns and got the same answer as auto_legacy
134-
block:
135-
- name: clear facts to force interpreter discovery to run
136-
meta: clear_facts
137-
138-
- name: trigger discovery with auto_legacy_silent
139-
vars:
140-
ansible_python_interpreter: auto_legacy_silent
141-
ping:
142-
register: legacy_silent
143-
144-
- assert:
145-
that:
146-
- legacy_silent.warnings is not defined
147-
- legacy_silent.ansible_facts.discovered_interpreter_python == legacy.ansible_facts.discovered_interpreter_python
148-
fail_msg: |
149-
legacy_silent={{ legacy_silent }}
150-
15189
- name: ensure modules can't set discovered_interpreter_X or ansible_X_interpreter
15290
block:
15391
- test_echo_module:
@@ -180,5 +118,3 @@
180118
- meta: clear_facts
181119
when:
182120
- ansible_version_major_minor is version('2.8', '>=', strict=True)
183-
tags:
184-
- ansible_2_8_tests
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
- name: integration/interpreter_discovery/auto_legacy.yml
2+
hosts: test-targets
3+
gather_facts: true
4+
tasks:
5+
- meta: end_play
6+
when:
7+
- ansible_version_major_minor is version('2.7', '<=', strict=True)
8+
or ansible_version_major_minor is version('2.21', '>=', strict=True)
9+
10+
- meta: clear_facts
11+
- name: Discover with auto
12+
vars:
13+
ansible_python_interpreter: auto
14+
ping:
15+
register: auto_discovered
16+
17+
- meta: clear_facts
18+
- name: Discover with auto_legacy
19+
vars:
20+
ansible_python_interpreter: auto_legacy
21+
ping:
22+
register: auto_legacy_discovered
23+
24+
- name: check for dep warning (only on platforms where auto result is not /usr/bin/python and legacy is) for ansible 2.8-2.11
25+
# from ansible 2.12 on this changed
26+
# - https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_5.html#python-interpreter-discovery
27+
# - https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html
28+
# default discovery method is now auto and will default to python3
29+
# and the message changed from a deprecation warning to a real warning that can not be suppressed by
30+
# using deprecation_warnings=False
31+
assert:
32+
that:
33+
- auto_legacy_discovered.deprecations | default([]) | length > 0
34+
fail_msg: |
35+
auto_legacy_discovered={{ auto_legacy_discovered }}
36+
# only check for a dep warning if auto_legacy returned /usr/bin/python and auto didn't
37+
when:
38+
- ansible_version_major_minor is version('2.12', '<', strict=True)
39+
- auto_legacy_discovered.ansible_facts.discovered_interpreter_python == '/usr/bin/python'
40+
- auto_discovered.ansible_facts.discovered_interpreter_python != '/usr/bin/python'
41+
42+
- name: check for warning (only on platforms where auto result is not /usr/bin/python and legacy is) from ansible 2.12 on
43+
assert:
44+
that:
45+
- auto_legacy_discovered.warnings | default([]) | length > 0
46+
fail_msg: |
47+
auto_legacy_discovered={{ auto_legacy_discovered }}
48+
# only check for a warning if auto_legacy returned /usr/bin/python and auto didn't
49+
when:
50+
- ansible_version_major_minor is version('2.12', '>=', strict=True)
51+
- auto_legacy_discovered.ansible_facts.discovered_interpreter_python == '/usr/bin/python'
52+
- auto_discovered.ansible_facts.discovered_interpreter_python != '/usr/bin/python'
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
- name: integration/interpreter_discovery/auto_legacy_slient.yml
2+
hosts: test-targets
3+
gather_facts: true
4+
tasks:
5+
- meta: end_play
6+
when:
7+
- ansible_version_major_minor is version('2.7', '<=', strict=True)
8+
or ansible_version_major_minor is version('2.21', '>=', strict=True)
9+
10+
- meta: clear_facts
11+
- name: Discover with auto_legacy_silent
12+
vars:
13+
ansible_python_interpreter: auto_legacy_silent
14+
ping:
15+
register: auto_legacy_silent_discovered
16+
17+
- assert:
18+
that:
19+
- auto_legacy_silent_discovered.warnings is not defined
20+
- auto_legacy_silent_discovered.ansible_facts.discovered_interpreter_python == legacy.ansible_facts.discovered_interpreter_python
21+
fail_msg: |
22+
auto_legacy_silent_discovered={{ auto_legacy_silent_discovered }}

tests/ansible/lib/modules/import_from_ansible_collections.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
__metaclass__ = type
66

77
from ansible.module_utils.basic import AnsibleModule
8-
from ansible_collections.community.general.plugins.module_utils.source_control import bitbucket
8+
try:
9+
from ansible_collections.community.general.plugins.module_utils import _bitbucket as bitbucket
10+
except ImportError:
11+
from ansible_collections.community.general.plugins.module_utils.source_control import bitbucket
912

1013

1114
def main():

tests/image_prep/_user_accounts.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
- name: Mitogen test users and groups
77
hosts: all
88
gather_facts: true
9-
strategy: mitogen_free
109
become: true
1110
pre_tasks:
1211
- name: Disable non-localhost SSH for Mitogen users

tests/image_prep/macos_localhost.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
- name: Configure macOS
22
hosts: all
33
gather_facts: true
4-
strategy: mitogen_free
54
become: true
65
roles:
76
- role: sshd

0 commit comments

Comments
 (0)