fix: resolve stale backend test imports and schema drift

- Delete 4 obsolete unit tests tied to removed git mount/clone models
- Update imports and assertions across unit/integration/service tests
- Fix Settings defaults (postgres host, JWT props, cookie_samesite)
- Add skip guards for PostgreSQL-dependent integration tests
- Fix GitService env assertions and HealthMonitor state-change tests
- Repair docker/container inspect assertions in test_docker_service
- Fix ToolTypeCreate default_port validator ordering bug
- Fix check_port_exposed substring false-positive for port 0
- Update test_tool_types_api_extended to use interface_type field

Quality gates: pytest 311 passed, 34 skipped; npm typecheck/lint/test 87 passed
This commit is contained in:
Developer
2026-06-12 20:23:17 +00:00
parent 79be4eb525
commit 81b9a66ef5
35 changed files with 268 additions and 625 deletions
+10 -10
View File
@@ -10,15 +10,15 @@ from fastapi.testclient import TestClient
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from src.api import events as events_module
from src.api.system import events as events_module
from src.auth.session import decode_session_cookie
from src.config import Settings
from src.models.git_repository import GitRepository
from src.models.instance_event import InstanceEvent
from src.models.project import Project
from src.models.tool_instance import ToolInstance
from src.models.tool_type import ToolType
from src.services.event_bus import InstanceEventBus, InstanceEventPayload
from src.models.project.git_repository import GitRepository
from src.models.system.instance_event import InstanceEvent
from src.models.project.project import Project
from src.models.tool.tool_instance import ToolInstance
from src.models.tool.tool_type import ToolType
from src.services.instance.event_bus import InstanceEventBus, InstanceEventPayload
@pytest.fixture
@@ -75,7 +75,7 @@ def test_sse_enforces_connection_limit(authenticated_client: TestClient) -> None
@pytest.mark.integration
def test_sse_event_generator_format() -> None:
"""Test the SSE endpoint is registered."""
from src.api.events import router
from src.api.system.events import router
route_paths = [getattr(r, "path", "") for r in router.routes]
assert any("/stream" in str(p) for p in route_paths)
@@ -142,7 +142,7 @@ async def test_lifecycle_hook_publishes_event_and_persists(
event_bus.subscribe("instance.created", subscriber)
from src.services.lifecycle_hooks import publish_lifecycle_event
from src.services.instance.lifecycle_hooks import publish_lifecycle_event
await publish_lifecycle_event(
event_bus=event_bus,
@@ -220,7 +220,7 @@ async def test_lifecycle_event_persists_audit_row(
db_session.add(instance)
await db_session.commit()
from src.services.lifecycle_hooks import publish_lifecycle_event
from src.services.instance.lifecycle_hooks import publish_lifecycle_event
await publish_lifecycle_event(
event_bus=event_bus,