Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
moreati committed Jul 29, 2024
1 parent 23d9d0b commit 2ba93dc
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .ci/azure-pipelines-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ steps:
set -o errexit
set -o nounset
set -o pipefail
set -o verbose
sudo apt-get update
sudo apt-get install -y python2-dev python3-pip virtualenv
Expand All @@ -28,6 +29,7 @@ steps:
set -o errexit
set -o nounset
set -o pipefail
set -o verbose
# macOS builders lack a realpath command
type python && python -c"import os.path;print(os.path.realpath('$(type -p python)'))" && python --version
Expand All @@ -52,6 +54,7 @@ steps:
set -o errexit
set -o nounset
set -o pipefail
set -o verbose
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12)
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "$(tox.env)"))')
Expand Down Expand Up @@ -79,6 +82,7 @@ steps:
set -o errexit
set -o nounset
set -o pipefail
set -o verbose
# Tox environment name (e.g. py312-mode_mitogen) -> Python executable name (e.g. python3.12)
PYTHON=$(python -c 'import re; print(re.sub(r"^py([23])([0-9]{1,2}).*", r"python\1.\2", "$(tox.env)"))')
Expand Down
17 changes: 3 additions & 14 deletions .ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,21 @@ trigger:
- docs-master

jobs:
- job: mac11
- job: mac12
# vanilla Ansible is really slow
timeoutInMinutes: 120
steps:
- template: azure-pipelines-steps.yml
pool:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-11-Readme.md
vmImage: macOS-11
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md
vmImage: macOS-12
strategy:
matrix:
Mito_27:
tox.env: py27-mode_mitogen
Mito_312:
python.version: '3.12'
tox.env: py312-mode_mitogen

Loc_27_210:
tox.env: py27-mode_localhost-ansible2.10
Loc_312_9:
python.version: '3.12'
tox.env: py312-mode_localhost-ansible9

Van_27_210:
tox.env: py27-mode_localhost-ansible2.10-strategy_linear
Van_312_9:
python.version: '3.12'
tox.env: py312-mode_localhost-ansible9-strategy_linear

- job: Linux
Expand Down
1 change: 1 addition & 0 deletions tests/ansible/hosts/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
pkg_mgr_python_interpreter: python
pkg_repos_overrides: []
26 changes: 26 additions & 0 deletions tests/ansible/hosts/group_vars/centos8.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,28 @@
---
pkg_mgr_python_interpreter: /usr/libexec/platform-python

pkg_repos_overrides:
- dest: /etc/yum.repos.d/CentOS-Linux-AppStream.repo
content: |
[appstream]
name=CentOS Linux $releasever - AppStream
baseurl=http://vault.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- dest: /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
content: |
[baseos]
name=CentOS Linux $releasever - BaseOS
baseurl=http://vault.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
- dest: /etc/yum.repos.d/CentOS-Linux-Extras.repo
content: |
[extras]
name=CentOS Linux $releasever - Extras
baseurl=http://vault.centos.org/$contentdir/$releasever/extras/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
4 changes: 4 additions & 0 deletions tests/ansible/hosts/group_vars/debian9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pkg_repos_overrides:
- dest: /etc/apt/sources.list
content: |
deb http://archive.debian.org/debian stretch main contrib non-free
3 changes: 1 addition & 2 deletions tests/ansible/integration/become/sudo_nonexistent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
# sudo-1.8.6p3-29.el6_10.3 on RHEL & CentOS 6.10 (final release)
# removed user/group error messages, as defence against CVE-2019-14287.
- >-
'sudo: unknown user: slartibartfast' in out.module_stdout | default(out.msg)
or 'sudo: unknown user: slartibartfast' in out.module_stderr | default(out.msg)
(out.module_stderr | default(out.module_stdout, true) | default(out.msg, true)) is search('sudo: unknown user:? slartibartfast')
or (ansible_facts.os_family == 'RedHat' and ansible_facts.distribution_version == '6.10')
fail_msg: out={{out}}
when:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# I am an Ansible Python JSONARGS module. I should receive an encoding string.

json_arguments = """<<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>"""
Expand Down
2 changes: 1 addition & 1 deletion tests/ansible/lib/modules/custom_python_os_getcwd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# #591: call os.getcwd() before AnsibleModule ever gets a chance to fix up the
# process environment.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# I am an Ansible Python WANT_JSON module. I should receive a JSON-encoded file.

import json
Expand Down
3 changes: 0 additions & 3 deletions tests/ansible/regression/issue_591__setuptools_cwd_crash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# Will crash if process has a nonexistent CWD.
- custom_python_os_getcwd:
script: |
import os
self._connection.get_chain().call(os.getcwd)
tags:
- issue_591
- mitogen_only
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
tasks:
- meta: end_play
when:
# TODO CI currently runs on macOS 11 images in Azure DevOps. MacOS 11
# is no longer supported by homebrew, so the following install
# task fails.
# TODO CI currently runs on macOS 12 & which isn't supported by Podman
# version available in Homebrew.
- ansible_facts.system == 'Darwin'
- ansible_facts.distribution_major_version == '11'
- ansible_facts.distribution_version is version('13.0', '<', strict=True)

- name: set up test container and run tests inside it
block:
Expand Down
22 changes: 10 additions & 12 deletions tests/ansible/regression/issue_776__load_plugins_called_twice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@
ansible_python_interpreter: "{{ pkg_mgr_python_interpreter }}"
package: rsync # Chosen to exist in all tested distros/package managers
tasks:
- name: Switch to centos-stream
command: dnf --assumeyes --disablerepo="*" --enablerepo=extras swap centos-linux-repos centos-stream-repos
when:
- ansible_facts.pkg_mgr in ["dnf"]
#- name: Switch to centos-stream
# command: dnf --assumeyes --disablerepo="*" --enablerepo=extras swap centos-linux-repos centos-stream-repos
# when:
# - ansible_facts.pkg_mgr in ["dnf"]

- name: Switch to archive.debian.org
# Debian 9 has been archived https://lists.debian.org/debian-devel-announce/2023/03/msg00006.html
- name: Switch to archived package repositories
copy:
content: |
deb http://archive.debian.org/debian stretch main contrib non-free
dest: /etc/apt/sources.list
dest: "{{ item.dest }}"
content: "{{ item.content }}"
mode: u=rw,go=r
when:
- ansible_facts.distribution == "Debian"
- ansible_facts.distribution_major_version == "9"
loop: "{{ pkg_repos_overrides }}"
loop_control:
label: "{{ item.dest }}"

- name: Add signing keys
copy:
Expand Down
3 changes: 3 additions & 0 deletions tests/ansible/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
paramiko==2.3.2 # Last 2.6-compat version.
# 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
PyYAML==3.11; python_version < '2.7'
PyYAML==5.3.1; python_version >= '2.7' # Latest release (Jan 2021)
3 changes: 3 additions & 0 deletions tests/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Setuptools 72 removed `setup.py test`. hdrhistogram 0.6.1 still depends on it.
# TODO Bump dependencies and unconstrain Pip.
setuptools<72
7 changes: 7 additions & 0 deletions tests/two_three_compat_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import os
import unittest

import mitogen.core

import testlib
Expand All @@ -7,6 +10,10 @@
# TODO: this is a joke. 2/3 interop is one of the hardest bits to get right.
# There should be 100 tests in this file.

@unittest.skipIf(
os.uname()[0] == 'Darwin' and int(os.uname()[2].partition('.')[0]) >= 21,
"Python 2.x not shipped on macOS 12.3+ (Darwin 21.4+, Monterey)",
)
class TwoThreeCompatTest(testlib.RouterMixin, testlib.TestCase):
if mitogen.core.PY3:
python_path = 'python2'
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ setenv =
ANSIBLE_STRATEGY = mitogen_linear
NOCOVERAGE_ERASE = 1
NOCOVERAGE_REPORT = 1
PIP_CONSTRAINT={toxinidir}/tests/constraints.txt
# Only applicable to MODE=mitogen
distro_centos5: DISTRO=centos5
distro_centos6: DISTRO=centos6
Expand Down

0 comments on commit 2ba93dc

Please sign in to comment.