Skip to content

Commit 812bef1

Browse files
[PR #10043/2a5abab7 backport][stable-8] Remove blanket skips for Python 3 in CI (#10046)
* Remove blanket skips for Python 3 in CI (#10043) * Remove blanket skips for Python 3 in CI. * Try to fix hg tests. * Disable hg tests. * Drop restriction of supervisor to <4.0.0. This was introduced in ansible/ansible#54935. * Make tests work with supervisorctl 4.0.0. According to https://supervisord.org/changes.html#id12, "supervisorctl will now set its exit code to a non-zero value when an error condition occurs." I'm not sure why a stopped service in 'status' constitutes an error condition, but whatever 🤷... * Use correct Python executable. * Skip RHEL/macOS; diff on config write. * Skip CentOS 7 and OpenSuSE on ansible-core 2.16. (cherry picked from commit 2a5abab) * Skip OpenSuSE 15/Python 2 on ansible-core 2.13. --------- Co-authored-by: Felix Fontein <[email protected]>
1 parent b742f7e commit 812bef1

File tree

10 files changed

+91
-54
lines changed

10 files changed

+91
-54
lines changed

tests/integration/targets/hg/aliases

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
# SPDX-License-Identifier: GPL-3.0-or-later
44

55
azp/posix/2
6-
skip/python3
76
skip/aix
7+
skip/macos
8+
disabled # TODO osdn.net is out of business, so cloning a repo from there does not work

tests/integration/targets/hg/meta/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
dependencies:
77
- setup_pkg_mgr
88
- setup_remote_tmp_dir
9+
- setup_epel

tests/integration/targets/hg/tasks/install.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
shell: apt-get -y update && apt-get -y install mercurial
2727
when: ansible_facts.pkg_mgr == 'apt'
2828

29+
- name: install packages (apk)
30+
package:
31+
name: mercurial
32+
state: present
33+
when: ansible_facts.pkg_mgr in ['apk', 'community.general.apk']
34+
2935
- name: install mercurial (dnf)
3036
dnf:
3137
name: mercurial
@@ -36,6 +42,11 @@
3642
name: mercurial
3743
when: ansible_facts.pkg_mgr == 'yum'
3844

45+
- name: install mercurial (pacman)
46+
package:
47+
name: mercurial
48+
when: ansible_facts.pkg_mgr in ['pacman', 'community.general.pacman']
49+
3950
- name: install mercurial (pkgng)
4051
package:
4152
name: mercurial

tests/integration/targets/hg/tasks/uninstall.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
line: "#!{{ stat_hg_interpreter.stat.path }}"
1717
when: stat_hg_interpreter.stat.islnk
1818

19+
- name: uninstall packages which were not originally installed (apk)
20+
package:
21+
name: mercurial
22+
state: absent
23+
when: ansible_facts.pkg_mgr in ['apk', 'community.general.apk']
24+
1925
# using the apt module prevents autoremove from working, so call apt-get via shell instead
2026
- name: uninstall packages which were not originally installed (apt)
2127
shell: apt-get -y remove mercurial && apt-get -y autoremove
@@ -33,6 +39,12 @@
3339
shell: yum -y autoremove mercurial
3440
when: ansible_facts.pkg_mgr == 'yum'
3541

42+
- name: uninstall packages which were not originally installed (pacman)
43+
package:
44+
name: mercurial
45+
state: absent
46+
when: ansible_facts.pkg_mgr in ['pacman', 'community.general.pacman']
47+
3648
- name: uninstall packages which were not originally installed (pkgng)
3749
package:
3850
name: mercurial

tests/integration/targets/supervisorctl/aliases

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44

55
azp/posix/2
66
destructive
7-
skip/python3
87
skip/aix
8+
skip/rhel # TODO executables are installed in /usr/local/bin, which isn't part of $PATH
9+
skip/macos # TODO executables are installed in /Library/Frameworks/Python.framework/Versions/3.11/bin, which isn't part of $PATH

tests/integration/targets/supervisorctl/tasks/install_pip.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
- name: install supervisord
77
pip:
8-
name: supervisor<4.0.0 # supervisor version 4.0.0 fails tests
8+
name: supervisor
99
state: present

tests/integration/targets/supervisorctl/tasks/main.yml

Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,54 @@
88
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
99
# SPDX-License-Identifier: GPL-3.0-or-later
1010

11-
- block:
12-
- tempfile:
13-
state: directory
14-
suffix: supervisorctl-tests
15-
register: supervisord_sock_path
16-
17-
- command: 'echo {{ remote_tmp_dir }}'
18-
register: echo
19-
- set_fact:
20-
remote_dir: '{{ echo.stdout }}'
21-
22-
- include_vars: '{{ item }}'
23-
with_first_found:
24-
- files:
25-
- '{{ ansible_distribution }}.yml'
26-
- '{{ ansible_os_family }}.yml'
27-
- 'defaults.yml'
28-
29-
- include_tasks: '{{ item }}'
30-
with_first_found:
31-
- files:
32-
- 'install_{{ ansible_distribution }}.yml' # CentOS
33-
- 'install_{{ ansible_os_family }}.yml' # RedHat
34-
- 'install_{{ ansible_system }}.yml' # Linux
35-
36-
- include_tasks: test.yml
37-
with_items:
38-
- { username: '', password: '' }
39-
- { username: 'testétest', password: 'passéword' } # non-ASCII credentials
40-
loop_control:
41-
loop_var: credentials
42-
43-
# setuptools is too old on RHEL/CentOS 6 (https://github.com/Supervisor/meld3/issues/23)
44-
when: ansible_os_family != 'RedHat' or ansible_distribution_major_version|int > 6
45-
46-
always:
47-
- include_tasks: '{{ item }}'
48-
when: ansible_os_family != 'RedHat' or ansible_distribution_major_version|int > 6
49-
with_first_found:
50-
- files:
51-
- 'uninstall_{{ ansible_distribution }}.yml' # CentOS
52-
- 'uninstall_{{ ansible_os_family }}.yml' # RedHat
53-
- 'uninstall_{{ ansible_system }}.yml' # Linux
54-
55-
- file:
56-
path: '{{ supervisord_sock_path.path }}'
57-
state: absent
11+
- when:
12+
# setuptools is too old on RHEL/CentOS 6 (https://github.com/Supervisor/meld3/issues/23)
13+
- ansible_os_family != 'RedHat' or ansible_distribution_major_version|int > 6
14+
# For some reason CentOS 7 and OpenSuSE 15 do not work on ansible-core 2.16
15+
- ansible_version.minor != 16 or ansible_distribution not in ['CentOS', 'openSUSE Leap']
16+
# For some reason, OpenSuSE 15 with Python 2 does ont work on ansible-core 2.13
17+
- ansible_version.minor != 13 or ansible_distribution != 'openSUSE Leap' or ansible_python.version.major != 2
18+
block:
19+
- block:
20+
- tempfile:
21+
state: directory
22+
suffix: supervisorctl-tests
23+
register: supervisord_sock_path
24+
25+
- command: 'echo {{ remote_tmp_dir }}'
26+
register: echo
27+
- set_fact:
28+
remote_dir: '{{ echo.stdout }}'
29+
30+
- include_vars: '{{ item }}'
31+
with_first_found:
32+
- files:
33+
- '{{ ansible_distribution }}.yml'
34+
- '{{ ansible_os_family }}.yml'
35+
- 'defaults.yml'
36+
37+
- include_tasks: '{{ item }}'
38+
with_first_found:
39+
- files:
40+
- 'install_{{ ansible_distribution }}.yml' # CentOS
41+
- 'install_{{ ansible_os_family }}.yml' # RedHat
42+
- 'install_{{ ansible_system }}.yml' # Linux
43+
44+
- include_tasks: test.yml
45+
with_items:
46+
- { username: '', password: '' }
47+
- { username: 'testétest', password: 'passéword' } # non-ASCII credentials
48+
loop_control:
49+
loop_var: credentials
50+
51+
always:
52+
- include_tasks: '{{ item }}'
53+
with_first_found:
54+
- files:
55+
- 'uninstall_{{ ansible_distribution }}.yml' # CentOS
56+
- 'uninstall_{{ ansible_os_family }}.yml' # RedHat
57+
- 'uninstall_{{ ansible_system }}.yml' # Linux
58+
59+
- file:
60+
path: '{{ supervisord_sock_path.path }}'
61+
state: absent

tests/integration/targets/supervisorctl/tasks/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
template:
88
src: supervisord.conf
99
dest: '{{ remote_dir }}/supervisord.conf'
10+
diff: true
1011

1112
- block:
1213
- import_tasks: start_supervisord.yml

tests/integration/targets/supervisorctl/tasks/test_start.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
when: credentials.username != ''
2323

2424
- command: "supervisorctl -c {{ remote_dir }}/supervisord.conf {% if credentials.username %}-u {{ credentials.username }} -p {{ credentials.password }}{% endif %} status"
25+
register: result_cmd
26+
failed_when: result_cmd.rc not in [0, 3]
2527

2628
- name: check that service is started
2729
assert:
@@ -30,8 +32,9 @@
3032
- (result is changed and result_with_auth is skip) or (result is skip and result_with_auth is changed)
3133

3234
- name: check that service is running (part1) # py1.log content is checked below
33-
script: "files/sendProcessStdin.py 'pys:py1' 2 \
34-
'{{ credentials.username }}' '{{ credentials.password }}'"
35+
script:
36+
cmd: "files/sendProcessStdin.py 'pys:py1' 2 '{{ credentials.username }}' '{{ credentials.password }}'"
37+
executable: "{{ ansible_facts.python.executable }}"
3538

3639
- name: try again to start py1 service (without auth)
3740
supervisorctl:

tests/integration/targets/supervisorctl/tasks/test_stop.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
when: credentials.username != ''
2525

2626
- command: "supervisorctl -c {{ remote_dir }}/supervisord.conf {% if credentials.username %}-u {{ credentials.username }} -p {{ credentials.password }}{% endif %} status"
27+
register: result_cmd
28+
failed_when: result_cmd.rc not in [0, 3]
2729

2830
- name: check that service is stopped
2931
assert:
@@ -32,8 +34,9 @@
3234
- (result is changed and result_with_auth is skip) or (result is skip and result_with_auth is changed)
3335

3436
- name: "check that service isn't running"
35-
script: "files/sendProcessStdin.py 'pys:py1' 1 \
36-
'{{ credentials.username }}' '{{ credentials.password }}'"
37+
script:
38+
cmd: "files/sendProcessStdin.py 'pys:py1' 1 '{{ credentials.username }}' '{{ credentials.password }}'"
39+
executable: "{{ ansible_facts.python.executable }}"
3740
register: is_py1_alive
3841
failed_when: is_py1_alive is success
3942

0 commit comments

Comments
 (0)