test(e2e): assert config ownership instead of absence from the stored row

/config/field/info used to answer from the LiteLLM_Config row, so "the field
400s" proved the row did not carry it. It now answers from the resolved
settings, and the CI stack config declares general_settings.max_parallel_requests,
so the endpoint returns that value and the old assertion could never hold.

The check that /add/allowed_ip writes only what the caller changed moves to
/config/list, which still reports stored_in_db off the row, and the field/info
call now asserts the ownership the endpoint reports: the config file owns the
key, so it reads back as source=config and editable=false.

Verified against a live proxy on an isolated Postgres rather than in CI, where
this check has never run: it waits on protected-environment approval.
This commit is contained in:
Yuneng Jiang 2026-09-18 02:52:00 -07:00
parent 2f3e4fa724
commit 0d9c5159df
No known key found for this signature in database

View file

@ -24,10 +24,10 @@ from collections.abc import Callable
from typing import Final
import pytest
from pydantic import BaseModel, JsonValue
from pydantic import BaseModel, JsonValue, RootModel
from e2e_config import unique_marker
from e2e_http import NoBody, Success, UnknownApiError, unwrap, unwrap_status
from e2e_http import NoBody, Success, unwrap, unwrap_status
from lifecycle import ResourceManager
from management_client import ManagementClient
from models import KeyGenerateBody, LiteLLMParamsBody, TeamNewBody
@ -210,6 +210,24 @@ class ConfigFieldInfoParams(BaseModel):
class ConfigFieldInfoResponse(BaseModel):
field_name: str
field_value: JsonValue
source: str
editable: bool
class ConfigListParams(BaseModel):
config_type: str
class ConfigListEntry(BaseModel):
field_name: str
field_value: JsonValue
stored_in_db: bool | None
source: str
editable: bool
class ConfigListResponse(RootModel[list[ConfigListEntry]]):
pass
class RouterCurrentValues(BaseModel):
@ -556,17 +574,30 @@ class TestConfigPersistence:
)
assert added.message == f"IP {allowed_ip} address added successfully"
field_info: Final = client.proxy.transport.get(
"/config/field/info",
headers=client.proxy.transport.master,
params=ConfigFieldInfoParams(field_name="max_parallel_requests"),
response_type=ConfigFieldInfoResponse,
listed: Final = unwrap(
client.proxy.transport.get(
"/config/list",
headers=client.proxy.transport.master,
params=ConfigListParams(config_type="general_settings"),
response_type=ConfigListResponse,
)
)
match field_info:
case UnknownApiError(status_code=400, body=body):
assert "is not set" in body
case _:
pytest.fail(f"expected max_parallel_requests to remain absent from the DB row, got {field_info}")
unrelated: Final = next(entry for entry in listed.root if entry.field_name == "max_parallel_requests")
assert unrelated.stored_in_db is not True
assert unrelated.source == "config"
assert unrelated.editable is False
field_info: Final = unwrap(
client.proxy.transport.get(
"/config/field/info",
headers=client.proxy.transport.master,
params=ConfigFieldInfoParams(field_name="max_parallel_requests"),
response_type=ConfigFieldInfoResponse,
)
)
assert field_info.source == "config"
assert field_info.editable is False
assert field_info.field_value == unrelated.field_value
class TestMcpServerSubmission: