feat(automation): 持久执行队列与重复充值确认
This commit is contained in:
@@ -23,6 +23,14 @@ def test_background_services_start_and_stop_once(monkeypatch):
|
||||
"web.backend.services.automation.stop_scheduler",
|
||||
mark("stop-scheduler"),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"web.backend.services.execution_worker.start_execution_job_worker",
|
||||
mark("execution"),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"web.backend.services.execution_worker.stop_execution_job_worker",
|
||||
mark("stop-execution"),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"web.backend.services.platform_fulfillment.reconciler."
|
||||
"start_platform_fulfillment_reconciler",
|
||||
@@ -78,6 +86,7 @@ def test_background_services_start_and_stop_once(monkeypatch):
|
||||
background_runtime.stop_background_services()
|
||||
|
||||
assert calls == [
|
||||
"execution",
|
||||
"register",
|
||||
"scheduler",
|
||||
"outbox",
|
||||
@@ -91,4 +100,27 @@ def test_background_services_start_and_stop_once(monkeypatch):
|
||||
"stop-reconciler",
|
||||
"stop-outbox",
|
||||
"stop-scheduler",
|
||||
"stop-execution",
|
||||
]
|
||||
|
||||
|
||||
def test_execution_only_worker_can_disable_control_plane(monkeypatch):
|
||||
calls: list[str] = []
|
||||
monkeypatch.setenv("BACKGROUND_CONTROL_PLANE_ENABLED", "false")
|
||||
monkeypatch.setattr(
|
||||
"web.backend.services.execution_worker.start_execution_job_worker",
|
||||
lambda: calls.append("start") or True,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"web.backend.services.execution_worker.stop_execution_job_worker",
|
||||
lambda: calls.append("stop"),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"web.backend.services.automation.start_scheduler",
|
||||
lambda: (_ for _ in ()).throw(AssertionError("control plane must stay off")),
|
||||
)
|
||||
|
||||
assert background_runtime.start_background_services() is True
|
||||
background_runtime.stop_background_services()
|
||||
|
||||
assert calls == ["start", "stop"]
|
||||
|
||||
Reference in New Issue
Block a user