Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/integration/targets/hg/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later

azp/posix/2
skip/python3
skip/aix
skip/macos
disabled # TODO osdn.net is out of business, so cloning a repo from there does not work
1 change: 1 addition & 0 deletions tests/integration/targets/hg/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
dependencies:
- setup_pkg_mgr
- setup_remote_tmp_dir
- setup_epel
11 changes: 11 additions & 0 deletions tests/integration/targets/hg/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
shell: apt-get -y update && apt-get -y install mercurial
when: ansible_facts.pkg_mgr == 'apt'

- name: install packages (apk)
package:
name: mercurial
state: present
when: ansible_facts.pkg_mgr in ['apk', 'community.general.apk']

- name: install mercurial (dnf)
dnf:
name: mercurial
Expand All @@ -36,6 +42,11 @@
name: mercurial
when: ansible_facts.pkg_mgr == 'yum'

- name: install mercurial (pacman)
package:
name: mercurial
when: ansible_facts.pkg_mgr in ['pacman', 'community.general.pacman']

- name: install mercurial (pkgng)
package:
name: mercurial
Expand Down
12 changes: 12 additions & 0 deletions tests/integration/targets/hg/tasks/uninstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
line: "#!{{ stat_hg_interpreter.stat.path }}"
when: stat_hg_interpreter.stat.islnk

- name: uninstall packages which were not originally installed (apk)
package:
name: mercurial
state: absent
when: ansible_facts.pkg_mgr in ['apk', 'community.general.apk']

# using the apt module prevents autoremove from working, so call apt-get via shell instead
- name: uninstall packages which were not originally installed (apt)
shell: apt-get -y remove mercurial && apt-get -y autoremove
Expand All @@ -33,6 +39,12 @@
shell: yum -y autoremove mercurial
when: ansible_facts.pkg_mgr == 'yum'

- name: uninstall packages which were not originally installed (pacman)
package:
name: mercurial
state: absent
when: ansible_facts.pkg_mgr in ['pacman', 'community.general.pacman']

- name: uninstall packages which were not originally installed (pkgng)
package:
name: mercurial
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/targets/supervisorctl/aliases
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

azp/posix/2
destructive
skip/python3
skip/aix
skip/rhel # TODO executables are installed in /usr/local/bin, which isn't part of $PATH
skip/macos # TODO executables are installed in /Library/Frameworks/Python.framework/Versions/3.11/bin, which isn't part of $PATH
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

- name: install supervisord
pip:
name: supervisor<4.0.0 # supervisor version 4.0.0 fails tests
name: supervisor
state: present
98 changes: 51 additions & 47 deletions tests/integration/targets/supervisorctl/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,54 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

- block:
- tempfile:
state: directory
suffix: supervisorctl-tests
register: supervisord_sock_path

- command: 'echo {{ remote_tmp_dir }}'
register: echo
- set_fact:
remote_dir: '{{ echo.stdout }}'

- include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- 'defaults.yml'

- include_tasks: '{{ item }}'
with_first_found:
- files:
- 'install_{{ ansible_distribution }}.yml' # CentOS
- 'install_{{ ansible_os_family }}.yml' # RedHat
- 'install_{{ ansible_system }}.yml' # Linux

- include_tasks: test.yml
with_items:
- { username: '', password: '' }
- { username: 'testétest', password: 'passéword' } # non-ASCII credentials
loop_control:
loop_var: credentials

# setuptools is too old on RHEL/CentOS 6 (https://github.com/Supervisor/meld3/issues/23)
when: ansible_os_family != 'RedHat' or ansible_distribution_major_version|int > 6

always:
- include_tasks: '{{ item }}'
when: ansible_os_family != 'RedHat' or ansible_distribution_major_version|int > 6
with_first_found:
- files:
- 'uninstall_{{ ansible_distribution }}.yml' # CentOS
- 'uninstall_{{ ansible_os_family }}.yml' # RedHat
- 'uninstall_{{ ansible_system }}.yml' # Linux

- file:
path: '{{ supervisord_sock_path.path }}'
state: absent
- when:
# setuptools is too old on RHEL/CentOS 6 (https://github.com/Supervisor/meld3/issues/23)
- ansible_os_family != 'RedHat' or ansible_distribution_major_version|int > 6
# For some reason CentOS 7 and OpenSuSE 15 do not work on ansible-core 2.16
- ansible_version.minor != 16 or ansible_distribution not in ['CentOS', 'openSUSE Leap']
# For some reason, OpenSuSE 15 with Python 2 does ont work on ansible-core 2.13
- ansible_version.minor != 13 or ansible_distribution != 'openSUSE Leap' or ansible_python.version.major != 2
block:
- block:
- tempfile:
state: directory
suffix: supervisorctl-tests
register: supervisord_sock_path

- command: 'echo {{ remote_tmp_dir }}'
register: echo
- set_fact:
remote_dir: '{{ echo.stdout }}'

- include_vars: '{{ item }}'
with_first_found:
- files:
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- 'defaults.yml'

- include_tasks: '{{ item }}'
with_first_found:
- files:
- 'install_{{ ansible_distribution }}.yml' # CentOS
- 'install_{{ ansible_os_family }}.yml' # RedHat
- 'install_{{ ansible_system }}.yml' # Linux

- include_tasks: test.yml
with_items:
- { username: '', password: '' }
- { username: 'testétest', password: 'passéword' } # non-ASCII credentials
loop_control:
loop_var: credentials

always:
- include_tasks: '{{ item }}'
with_first_found:
- files:
- 'uninstall_{{ ansible_distribution }}.yml' # CentOS
- 'uninstall_{{ ansible_os_family }}.yml' # RedHat
- 'uninstall_{{ ansible_system }}.yml' # Linux

- file:
path: '{{ supervisord_sock_path.path }}'
state: absent
1 change: 1 addition & 0 deletions tests/integration/targets/supervisorctl/tasks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
template:
src: supervisord.conf
dest: '{{ remote_dir }}/supervisord.conf'
diff: true

- block:
- import_tasks: start_supervisord.yml
Expand Down
7 changes: 5 additions & 2 deletions tests/integration/targets/supervisorctl/tasks/test_start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
when: credentials.username != ''

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

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

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

- name: try again to start py1 service (without auth)
supervisorctl:
Expand Down
7 changes: 5 additions & 2 deletions tests/integration/targets/supervisorctl/tasks/test_stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
when: credentials.username != ''

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

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

- name: "check that service isn't running"
script: "files/sendProcessStdin.py 'pys:py1' 1 \
'{{ credentials.username }}' '{{ credentials.password }}'"
script:
cmd: "files/sendProcessStdin.py 'pys:py1' 1 '{{ credentials.username }}' '{{ credentials.password }}'"
executable: "{{ ansible_facts.python.executable }}"
register: is_py1_alive
failed_when: is_py1_alive is success

Expand Down