From 609b3f8ded2012e3b23223be48eb43a028be7ed1 Mon Sep 17 00:00:00 2001 From: yucheng Date: Wed, 23 Sep 2026 07:52:18 +0000 Subject: [PATCH] test(integration): accept list-valued top-level keys in the base integration proxy config The shared tests/integration/proxy_config.yaml now carries list-valued top-level keys, so the retention config helper validates only the mapping it merges into. Also drops a SQL-shape assertion from the unit test in favor of the behavioral cutoff-day check Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- tests/integration/spend/test_daily_tag_spend_retention.py | 6 +++--- tests/test_litellm/proxy/test_spend_log_cleanup.py | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/integration/spend/test_daily_tag_spend_retention.py b/tests/integration/spend/test_daily_tag_spend_retention.py index b231819962c..5cbee96a2b1 100644 --- a/tests/integration/spend/test_daily_tag_spend_retention.py +++ b/tests/integration/spend/test_daily_tag_spend_retention.py @@ -14,7 +14,7 @@ from tests.integration._support.database import read_rows from tests.integration._support.process import owned_proxy CLEANUP_EVERY_MINUTE: Final = "* * * * *" -_CONFIG: Final = TypeAdapter(dict[str, dict[str, JsonValue]]) +_MAPPING: Final = TypeAdapter(dict[str, JsonValue]) def _day(days_ago: int) -> str: @@ -55,11 +55,11 @@ def _spend_log_present(request_id: str) -> bool: def _cleanup_config(tmp_path: Path, retention: dict[str, JsonValue]) -> Path: - base: Final = _CONFIG.validate_python(yaml.safe_load(Path("tests/integration/proxy_config.yaml").read_text())) + base: Final = _MAPPING.validate_python(yaml.safe_load(Path("tests/integration/proxy_config.yaml").read_text())) config: Final = { **base, "general_settings": { - **base["general_settings"], + **_MAPPING.validate_python(base["general_settings"]), **retention, "maximum_spend_logs_cleanup_cron": CLEANUP_EVERY_MINUTE, "scheduled_job_stagger": {"enabled": False}, diff --git a/tests/test_litellm/proxy/test_spend_log_cleanup.py b/tests/test_litellm/proxy/test_spend_log_cleanup.py index 612b24d7dd7..da78c96e8e3 100644 --- a/tests/test_litellm/proxy/test_spend_log_cleanup.py +++ b/tests/test_litellm/proxy/test_spend_log_cleanup.py @@ -835,7 +835,6 @@ async def test_daily_tag_spend_retention_alone_prunes_only_that_table_by_calenda tables = [call[0][0] for call in client.db.execute_raw.call_args_list] assert len(tables) == 1 assert '"LiteLLM_DailyTagSpend"' in tables[0] - assert '"date" < $1::text' in tables[0] cutoff_day = client.db.execute_raw.call_args[0][1] assert cutoff_day == (datetime.now(timezone.utc) - timedelta(days=90)).date().isoformat()