community.general/tests/integration/targets/supervisorctl/tasks/test_stop.yml
patchback[bot] 812bef1791
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.13) (push) Waiting to run
EOL CI / EOL Sanity (Ⓐ2.14) (push) Waiting to run
EOL CI / EOL Sanity (Ⓐ2.15) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.13+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.13+py3.8) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.14+py3.9) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.13+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.13+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.13+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.13+fedora35+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.13+fedora35+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.13+fedora35+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.13+opensuse15py2+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.13+opensuse15py2+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.13+opensuse15py2+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.14+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.14+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.14+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Waiting to run
import-galaxy / Test to import built collection artifact with Galaxy importer (push) Waiting to run
Verify REUSE / check (push) Waiting to run
[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 https://github.com/ansible/ansible/pull/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 2a5abab738)

* Skip OpenSuSE 15/Python 2 on ansible-core 2.13.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2025-04-21 16:38:44 +02:00

67 lines
2.4 KiB
YAML

---
# Copyright (c) Ansible Project
# 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
- name: stop py1 service
supervisorctl:
name: 'pys:py1'
state: stopped
# test with 'server_url' parameter
server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
register: result
when: credentials.username == ''
- name: stop py1 service
supervisorctl:
name: 'pys:py1'
state: stopped
# test with unix socket
server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
username: '{{ credentials.username }}'
password: '{{ credentials.password }}'
register: result_with_auth
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:
that:
- (result is success and result_with_auth is skip) or (result is skip and result_with_auth is success)
- (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:
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
- name: try again to stop py1 service (without auth)
supervisorctl:
name: pys:py1
state: stopped
# test with 'server_url' parameter
server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
register: result
when: credentials.username == ''
- name: try again to stop py1 service (with auth)
supervisorctl:
name: pys:py1
state: stopped
# test with unix socket
server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
username: '{{ credentials.username }}'
password: '{{ credentials.password }}'
register: result_with_auth
when: credentials.username != ''
- name: check that service is already stopped
assert:
that:
- (result is success and result_with_auth is skip) or (result is skip and result_with_auth is success)
- (result is not changed and result_with_auth is skip) or (result is skip and result_with_auth is not changed)