Единый http сервис на одном порту

This commit is contained in:
2026-05-14 21:08:18 +03:00
parent e2b817f785
commit e6509ee0cd
9 changed files with 174 additions and 31 deletions
+25
View File
@@ -15,6 +15,7 @@ from app_runtime.core.registration import ModuleRegistry
from app_runtime.core.runtime import RuntimeManager
from app_runtime.http.base import ApplicationHttpChannel
from app_runtime.http.http_channel import HttpApplicationChannel
from app_runtime.http.unified_service import UnifiedHttpService
try:
import python_multipart # noqa: F401
@@ -207,3 +208,27 @@ def test_control_plane_and_application_http_work_independently() -> None:
finally:
runtime.control_plane.stop()
runtime.stop(stop_control_plane=False)
def test_unified_http_serves_control_and_application_routes_on_one_app() -> None:
runtime = RuntimeManager(application_http=UnifiedHttpService())
channel = RecordingChannel()
runtime.application_http.register_channel(channel)
runtime.register_module(HttpModule(PingRoutes()))
runtime.start(start_control_plane=False)
try:
client = _application_client(channel)
with client:
health_response = client.get("/health")
action_response = client.get("/actions/status")
app_response = client.get("/estimate/ping")
assert health_response.status_code == 200
assert health_response.json()["status"] == "ok"
assert action_response.status_code == 200
assert action_response.json() == {"status": "ok", "detail": "idle"}
assert app_response.status_code == 200
assert app_response.json() == {"status": "ok"}
finally:
runtime.stop(stop_control_plane=False)