diff --git a/tests/integration/database/test_performance_issues.py b/tests/integration/database/test_performance_issues.py index 7b419657d77..2e2379f8a1b 100644 --- a/tests/integration/database/test_performance_issues.py +++ b/tests/integration/database/test_performance_issues.py @@ -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 ) diff --git a/tests/unit/proxy/spend_tracking/test_deprecation_issues.py b/tests/unit/proxy/spend_tracking/test_deprecation_issues.py index 3b52e09135b..9dbf701d0a5 100644 --- a/tests/unit/proxy/spend_tracking/test_deprecation_issues.py +++ b/tests/unit/proxy/spend_tracking/test_deprecation_issues.py @@ -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