refactor(db)!: finalize pooled WNDB v2 migration
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from uuid import uuid4
|
||||
@@ -12,6 +11,7 @@ from fastapi.testclient import TestClient
|
||||
|
||||
from app.api.v1.endpoints import simulation as simulation_endpoint
|
||||
from app.api.pagination import PaginatedList
|
||||
from app.api.problem_details import install_problem_details_handlers
|
||||
from app.api.v1.rest_router import api_router, build_rest_router
|
||||
from app.api.v1.router import api_router as source_api_router
|
||||
from app.auth.project_dependencies import (
|
||||
@@ -207,19 +207,51 @@ def test_valve_isolation_route_uses_the_isolation_handler() -> None:
|
||||
assert route.name == "valve_isolation_endpoint"
|
||||
|
||||
|
||||
def test_open_project_route_requires_business_and_timescale_routing() -> None:
|
||||
route = next(
|
||||
route
|
||||
def test_legacy_project_pool_lifecycle_routes_are_not_published() -> None:
|
||||
operations = {
|
||||
(method, route.path)
|
||||
for route in api_router.routes
|
||||
if isinstance(route, APIRoute)
|
||||
and route.path == "/projects/current"
|
||||
and route.methods == {"POST"}
|
||||
)
|
||||
routing_parameter = inspect.signature(route.endpoint).parameters[
|
||||
"_rest_project_routing"
|
||||
]
|
||||
for method in route.methods or set()
|
||||
}
|
||||
|
||||
assert routing_parameter.default.dependency is get_project_simulation_routing
|
||||
assert ("POST", "/projects/current") not in operations
|
||||
assert ("DELETE", "/projects/current") not in operations
|
||||
assert ("GET", "/projects/current/status") not in operations
|
||||
|
||||
|
||||
def test_legacy_server_filesystem_inp_routes_are_not_published() -> None:
|
||||
operations = {
|
||||
(method, route.path)
|
||||
for route in source_api_router.routes
|
||||
if isinstance(route, APIRoute)
|
||||
for method in route.methods or set()
|
||||
}
|
||||
|
||||
assert operations.isdisjoint(
|
||||
{
|
||||
("POST", "/projects/current/imports"),
|
||||
("POST", "/projects/current/exports/inp"),
|
||||
("GET", "/projects/current/files/inp"),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_committed_write_refresh_failure_has_explicit_http_contract() -> None:
|
||||
from app.native.wndb.core.database import MaterializedViewRefreshAfterCommitError
|
||||
|
||||
app = FastAPI()
|
||||
install_problem_details_handlers(app)
|
||||
|
||||
@app.get("/probe")
|
||||
def probe():
|
||||
raise MaterializedViewRefreshAfterCommitError("project_a")
|
||||
|
||||
response = TestClient(app, raise_server_exceptions=False).get("/probe")
|
||||
|
||||
assert response.status_code == 503
|
||||
assert response.headers["X-TJWater-Changes-Committed"] == "true"
|
||||
assert response.json()["code"] == "materialized_view_refresh_failed_after_commit"
|
||||
|
||||
|
||||
def test_valve_isolation_runtime_accepts_frontend_query(monkeypatch) -> None:
|
||||
|
||||
Reference in New Issue
Block a user