update minio port

This commit is contained in:
Kevin
2026-05-22 09:35:41 +08:00
parent 153c91f8ff
commit 62b14d7386
22 changed files with 1256 additions and 1170 deletions

View File

@@ -1,7 +1,7 @@
"""FastAPI → 算法子进程调用链单元测试。
覆盖两条生产路径:
1. ``POST /internal/demo/offline-batch`` → ``VideoBatchRunner`` → ``subprocess.run``reference bundle ``main.py``
1. ``POST /internal/demo/offline-batch`` → ``BatchAlgorithmService`` → ``subprocess.run``reference bundle ``main.py``
2. ``POST /client/surgeries/start`` → ``CameraSessionManager`` → ``asyncio.create_subprocess_exec````python -m app.algorithm_runner``
"""
@@ -24,8 +24,9 @@ from app.config import Settings
from app.dependencies import build_container, get_surgery_pipeline, get_voice_terminal_hub
from app.routers import recording_demo
from app.services.video.session_manager import CameraSessionManager
from app.services.video_batch_runner import VideoBatchRunner, build_reference_command
from tests.test_video_batch_runner import _complete_result_tsv_body, _write_minimal_reference_bundle
from app.algo_host.batch_service import BatchAlgorithmService
from app.algo_host.subprocess_runner import build_batch_main_command
from tests.reference_bundle_fixtures import complete_result_tsv_body, write_minimal_reference_bundle
def _fake_reference_subprocess_run(captured: list[dict[str, Any]]):
@@ -46,7 +47,7 @@ def _fake_reference_subprocess_run(captured: list[dict[str, Any]]):
)
output = Path(config["io"]["out"])
output.parent.mkdir(parents=True, exist_ok=True)
output.write_text(_complete_result_tsv_body(), encoding="utf-8")
output.write_text(complete_result_tsv_body(), encoding="utf-8")
return _Proc()
return _run
@@ -55,7 +56,7 @@ def _fake_reference_subprocess_run(captured: list[dict[str, Any]]):
@pytest.fixture
def reference_bundle(tmp_path: Path) -> Path:
bundle = tmp_path / "algorithm_subprocesses" / "5.15"
_write_minimal_reference_bundle(bundle)
write_minimal_reference_bundle(bundle)
return bundle
@@ -67,17 +68,13 @@ def test_video_batch_endpoint_invokes_reference_bundle_subprocess(
) -> None:
monkeypatch.setattr(recording_demo.settings, "demo_orchestrator_enabled", True)
monkeypatch.setattr(
"app.services.video_batch_runner.resolve_reference_bundle_dir",
"app.algo_host.bundle.resolve_reference_bundle_dir",
lambda _override=None: reference_bundle.resolve(),
)
monkeypatch.setattr(
"app.services.video_batch_runner.ensure_reference_actionformer_nms_patch",
lambda _bundle: True,
)
monkeypatch.setattr(
recording_demo,
"VideoBatchRunner",
lambda: VideoBatchRunner(
"BatchAlgorithmService",
lambda: BatchAlgorithmService(
bundle_dir=reference_bundle,
root_dir=tmp_path / "video_batch",
),
@@ -85,7 +82,7 @@ def test_video_batch_endpoint_invokes_reference_bundle_subprocess(
captured: list[dict[str, Any]] = []
monkeypatch.setattr(
"app.services.video_batch_runner.subprocess.run",
"app.algo_host.subprocess_runner.subprocess.run",
_fake_reference_subprocess_run(captured),
)
@@ -111,7 +108,7 @@ def test_video_batch_endpoint_invokes_reference_bundle_subprocess(
cmd: list[str] = call["cmd"]
kwargs: dict[str, Any] = call["kwargs"]
expected = build_reference_command(
expected = build_batch_main_command(
bundle_dir=reference_bundle,
config_path=Path(cmd[cmd.index("--config") + 1]),
)