mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-13 22:26:49 +00:00
`retries: 30` with `delay: 10` only bounded the wait while each
`occ onlyoffice:documentserver --check` failed fast. onlyoffice v10.2.1
gives the health check and the version command 60 s each and the
conversion 120 s, so a document server that accepts connections but
does not answer held the deploy for up to two hours before it failed.
The retries now also stop once a deadline of
`lookup('timeout', 300)` seconds, set right before the check, has
passed. A per-attempt `timeout:` would not bound the total: ansible-core
2.21 leaves the `until` loop on the first timed-out attempt, so only a
limit below onlyoffice's 60 s would end a hanging server's loop.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
from utils.cache.files import PROJECT_ROOT, read_text
|
|
from utils.cache.yaml import load_yaml_str
|
|
|
|
TASKS = PROJECT_ROOT / "roles/web-app-nextcloud/tasks/addons/onlyoffice.yml"
|
|
|
|
|
|
class TestOnlyofficeCheckDeadline(unittest.TestCase):
|
|
def setUp(self) -> None:
|
|
self.tasks = load_yaml_str(read_text(str(TASKS)))
|
|
|
|
def test_the_deadline_is_set_before_the_check(self) -> None:
|
|
deadline, check = self.tasks
|
|
self.assertIn("nextcloud_onlyoffice_check_deadline", deadline["set_fact"])
|
|
self.assertIn("lookup('timeout'", deadline["set_fact"]["nextcloud_onlyoffice_check_deadline"])
|
|
self.assertEqual(check["register"], "nextcloud_onlyoffice_check")
|
|
|
|
def test_the_retries_stop_at_the_deadline(self) -> None:
|
|
until = self.tasks[1]["until"]
|
|
self.assertIn("nextcloud_onlyoffice_check.rc == 0", until)
|
|
self.assertIn("now(utc=true).timestamp() > nextcloud_onlyoffice_check_deadline", until)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|