Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/supervisorctl/tasks/test_stop.yml

raw
1 ---
2 # Copyright (c) Ansible Project
3 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 - name: stop py1 service
7 supervisorctl:
8 name: 'pys:py1'
9 state: stopped
10 # test with 'server_url' parameter
11 server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
12 register: result
13 when: credentials.username == ''
14
15 - name: stop py1 service
16 supervisorctl:
17 name: 'pys:py1'
18 state: stopped
19 # test with unix socket
20 server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
21 username: '{{ credentials.username }}'
22 password: '{{ credentials.password }}'
23 register: result_with_auth
24 when: credentials.username != ''
25
26 - 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]
29
30 - name: check that service is stopped
31 assert:
32 that:
33 - (result is success and result_with_auth is skip) or (result is skip and result_with_auth is success)
34 - (result is changed and result_with_auth is skip) or (result is skip and result_with_auth is changed)
35
36 - name: "check that service isn't running"
37 script:
38 cmd: "files/sendProcessStdin.py 'pys:py1' 1 '{{ credentials.username }}' '{{ credentials.password }}'"
39 executable: "{{ ansible_facts.python.executable }}"
40 register: is_py1_alive
41 failed_when: is_py1_alive is success
42
43 - name: try again to stop py1 service (without auth)
44 supervisorctl:
45 name: pys:py1
46 state: stopped
47 # test with 'server_url' parameter
48 server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
49 register: result
50 when: credentials.username == ''
51
52 - name: try again to stop py1 service (with auth)
53 supervisorctl:
54 name: pys:py1
55 state: stopped
56 # test with unix socket
57 server_url: 'unix://{{ supervisord_sock_path.path }}/supervisord.sock'
58 username: '{{ credentials.username }}'
59 password: '{{ credentials.password }}'
60 register: result_with_auth
61 when: credentials.username != ''
62
63 - name: check that service is already stopped
64 assert:
65 that:
66 - (result is success and result_with_auth is skip) or (result is skip and result_with_auth is success)
67 - (result is not changed and result_with_auth is skip) or (result is skip and result_with_auth is not changed)