feat: harden multi-host runtime coordination

This commit is contained in:
2026-08-02 05:30:11 +02:00
parent b58c9c55cf
commit d6255f9f8f
7 changed files with 92 additions and 7 deletions
+17
View File
@@ -123,3 +123,20 @@ def test_worker_disables_consumers_without_reclaiming_stale_identity(
celery_app._worker_consumer,
celery_app._worker_draining,
) = original_state
def test_worker_child_replaces_inherited_database_pool(monkeypatch) -> None:
from govoplan_core import celery_app
calls: list[tuple[str, bool]] = []
monkeypatch.setattr(
celery_app,
"configure_database",
lambda url, *, dispose_previous=False: calls.append(
(url, dispose_previous)
),
)
celery_app._reset_worker_process_database()
assert calls == [(celery_app.settings.database_url, True)]
+7
View File
@@ -18,6 +18,7 @@ from govoplan_core.core.runtime_coordination import (
list_runtime_nodes,
register_runtime_node,
request_runtime_node_drain,
runtime_composition_hash,
)
from govoplan_core.db.base import Base
@@ -128,3 +129,9 @@ def test_expired_lease_reassignment_increments_fence() -> None:
finally:
session.close()
engine.dispose()
def test_runtime_composition_hash_is_order_and_duplicate_independent() -> None:
assert runtime_composition_hash(("files", "core", "files")) == (
runtime_composition_hash(("core", "files"))
)