mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-13 08:52:02 +00:00
test(alerts): verify checkpoint revision transition within worker budget
This commit is contained in:
parent
7d576232de
commit
d107312230
2 changed files with 7 additions and 4 deletions
|
|
@ -240,7 +240,7 @@ async def test_key_spend_issue_consolidates_traffic_and_uses_fresh_days(db: Mana
|
|||
assert original.comparisons[0].baseline_value == 1
|
||||
assert original.comparisons[1].observed_value == 50000
|
||||
assert original.comparisons[1].threshold is None
|
||||
expected_days = tuple(_DAY - timedelta(days=offset) for offset in range(7, -1, -1))
|
||||
expected_days: Final = tuple(_DAY - timedelta(days=offset) for offset in range(7, -1, -1))
|
||||
assert tuple(point.day for point in original.comparisons[0].history) == expected_days
|
||||
assert tuple(point.value for point in original.comparisons[0].history) == (1,) * 7 + (50,)
|
||||
assert tuple(point.value for point in original.comparisons[1].history) == (1000,) * 7 + (50000,)
|
||||
|
|
@ -860,8 +860,10 @@ async def test_projection_resume_keeps_spend_and_traffic_in_one_episode(db: Mana
|
|||
restarted: Final = UsageAlertJob.from_prisma(prisma, SlackAlerting(alerting=[], alert_types=[]))
|
||||
assert restarted._performance_projection is not None
|
||||
assert not await restarted._performance_projection.run_pending(
|
||||
_NOW + timedelta(hours=1), latest, restarted._store, asyncio.get_running_loop().time() + 10
|
||||
_NOW + timedelta(hours=1), latest, restarted._store, asyncio.get_running_loop().time() + 60
|
||||
)
|
||||
resumed: Final = await restarted._store.projection_cursor(latest)
|
||||
assert resumed.version == latest.version and resumed.step == 0
|
||||
assert await restarted._performance_projection.run_pending(
|
||||
_NOW + timedelta(hours=2), latest, restarted._store, asyncio.get_running_loop().time() + 60
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from datetime import date, datetime, timedelta, timezone
|
||||
from typing import Final
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -140,11 +141,11 @@ def test_retirement_candidates_are_bounded_and_preserve_alias_choice() -> None:
|
|||
|
||||
|
||||
def test_retirement_keeps_recorded_daily_usage_in_the_saved_issue() -> None:
|
||||
points = (
|
||||
points: Final = (
|
||||
UsageAlertMetricPoint(day=NOW.date() - timedelta(days=2), value=670),
|
||||
UsageAlertMetricPoint(day=NOW.date(), value=30),
|
||||
)
|
||||
recorded = usage().model_copy(update={"daily_requests": points})
|
||||
recorded: Final = usage().model_copy(update={"daily_requests": points})
|
||||
issue = used_deprecation_issues(deprecation_candidates((model(),)), {recorded.model: recorded}, {}, NOW)[0]
|
||||
assert issue.deprecation is not None
|
||||
assert issue.deprecation.daily_requests == points
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue