1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

test(integration): monit: backport of PR 11255 (#11273)

* test(integration): monit: backport of PR 11255

* add changelog frag
This commit is contained in:
Alexei Znamensky 2025-12-12 19:25:09 +13:00 committed by GitHub
parent bc61b2d656
commit b2f16f184a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- monit - add delay of 0.5 seconds after state change and check for status (https://github.com/ansible-collections/community.general/pull/11255).

View file

@ -259,6 +259,9 @@ class Monit(object):
def change_state(self, state, expected_status, invert_expected=None):
current_status = self.get_status()
self.run_command(STATE_COMMAND_MAP[state])
# Give monit daemon a moment to process the command before checking status
# to avoid race condition where HTTP interface may be temporarily unresponsive
time.sleep(0.5)
status = self.wait_for_status_change(current_status)
status = self.wait_for_monit_to_stop_pending(status)
status_match = status.value == expected_status.value

View file

@ -52,6 +52,14 @@
name: monit
state: restarted
- name: wait for monit daemon to be responsive after restart
command: monit status -B httpd_echo
register: monit_status_check
changed_when: false
until: monit_status_check.rc == 0
retries: 10
delay: 0.5
- name: test process present again
monit:
name: httpd_echo