feat: harden multi-host runtime coordination
This commit is contained in:
@@ -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)]
|
||||
|
||||
@@ -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"))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user