mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
test(e2e): cover team update persistence via /team/info (#33997)
Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
This commit is contained in:
parent
68be053e96
commit
eb27447a1d
3 changed files with 40 additions and 1 deletions
|
|
@ -41,6 +41,7 @@ from models import (
|
|||
TeamMemberEntry,
|
||||
TeamNewBody,
|
||||
TeamNewResponse,
|
||||
TeamUpdateBody,
|
||||
UserDeleteBody,
|
||||
UserInfoParams,
|
||||
UserInfoResponse,
|
||||
|
|
@ -138,6 +139,28 @@ class ManagementClient:
|
|||
self._wait_for_team(team_id)
|
||||
return team_id
|
||||
|
||||
def update_team(self, body: TeamUpdateBody) -> None:
|
||||
last: Result[NoBody] | None = None
|
||||
for attempt in range(5):
|
||||
last = self.proxy.transport.post(
|
||||
"/team/update",
|
||||
headers=self.proxy.transport.master,
|
||||
json=body,
|
||||
response_type=NoBody,
|
||||
)
|
||||
match last:
|
||||
case Success():
|
||||
return
|
||||
case UnknownApiError(body=body_text) if (
|
||||
"connecting to redis" in body_text.lower() or "name resolution" in body_text.lower()
|
||||
):
|
||||
time.sleep(0.5 * (attempt + 1))
|
||||
continue
|
||||
case _:
|
||||
break
|
||||
assert last is not None
|
||||
raise AssertionError(last)
|
||||
|
||||
def delete_team(self, team_id: str) -> None:
|
||||
_ = self.proxy.transport.post(
|
||||
"/team/delete",
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ from management_client import (
|
|||
ROUTE_NOT_ALLOWED_MARKER,
|
||||
ManagementClient,
|
||||
)
|
||||
from models import KeyGenerateBody, OrgNewBody, TagListEntry, TagNewBody, TeamNewBody, UserNewBody, LiteLLMParamsBody, ModelInfoEntry
|
||||
from models import KeyGenerateBody, OrgNewBody, TagListEntry, TagNewBody, TeamNewBody, TeamUpdateBody, UserNewBody, LiteLLMParamsBody, ModelInfoEntry
|
||||
|
||||
pytestmark = pytest.mark.e2e
|
||||
|
||||
|
|
@ -227,6 +227,17 @@ class TestTeamRoutes:
|
|||
f"key generated under team {team_id} carries team_id {key_info.team_id!r} in /key/info"
|
||||
)
|
||||
|
||||
@pytest.mark.covers("mgmt.team.update.persists")
|
||||
def test_update_persists_to_team_info(self, client: ManagementClient, resources: ResourceManager) -> None:
|
||||
team_id = _create_team(client, resources, f"e2e-mgmt-team-{unique_marker()}", ["gemini-2.5-flash"])
|
||||
|
||||
updated_alias = f"e2e-mgmt-team-updated-{unique_marker()}"
|
||||
client.update_team(TeamUpdateBody(team_id=team_id, team_alias=updated_alias))
|
||||
|
||||
def reflected() -> bool | None:
|
||||
return True if client.team_info(team_id).team_alias == updated_alias else None
|
||||
|
||||
_ = _poll(client, reflected, f"/team/info never reflected team_alias {updated_alias!r} after /team/update")
|
||||
@pytest.mark.covers("mgmt.team.list.happy_path")
|
||||
def test_created_team_appears_in_team_list(
|
||||
self, client: ManagementClient, resources: ResourceManager
|
||||
|
|
|
|||
|
|
@ -625,6 +625,11 @@ class TeamNewResponse(BaseModel):
|
|||
team_id: str
|
||||
|
||||
|
||||
class TeamUpdateBody(BaseModel):
|
||||
team_id: str
|
||||
team_alias: str
|
||||
|
||||
|
||||
class TeamInfoParams(BaseModel):
|
||||
team_id: str
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue