From 285e776feea8bb41437c03b2e51019e9ba6bd815 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Mon, 16 Nov 2026 13:20:21 -0800 Subject: [PATCH] test: update four stale integration and UI tests for intended behavior changes (#52108) The alerts monitoring response now carries model_deprecations_enabled (#51418), and the licensed integration gateway reports no free alert limit. The migration job now builds the DailyUserSpend index it owns (#50666). /key/generate rejects guardrail names the proxy does not know (#51080), so the E2 key is created on the proxy that defines the guardrail. The key detail tab is kept in the URL (#51104), so the reload spec opens Overview before reading the cap. --- .../e2e/ui/tests/proxy-admin/keyBudgetWindow.spec.ts | 1 + tests/integration/database/test_performance_alerts.py | 8 +++++++- .../database/test_request_log_indexes_at_boot.py | 6 +++++- .../observability/test_logging_only_scope_runtime.py | 11 +++++++---- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/tests/e2e/ui/tests/proxy-admin/keyBudgetWindow.spec.ts b/tests/e2e/ui/tests/proxy-admin/keyBudgetWindow.spec.ts index d0b1bb9ecfb..a98a112893b 100644 --- a/tests/e2e/ui/tests/proxy-admin/keyBudgetWindow.spec.ts +++ b/tests/e2e/ui/tests/proxy-admin/keyBudgetWindow.spec.ts @@ -98,6 +98,7 @@ test.describe("Proxy Admin - Key budget window", () => { expect(resetAt.getUTCDate(), "a monthly window resets on the 1st, a daily one would not").toBe(1); await page.reload(); + await page.getByRole("tab", { name: "Overview", exact: true }).click(); await expect( page.getByRole("paragraph").filter({ hasText: "of $12.50" }), "the reloaded key detail does not render the $12.50 cap", diff --git a/tests/integration/database/test_performance_alerts.py b/tests/integration/database/test_performance_alerts.py index aea5bfa03a5..7b529a2a754 100644 --- a/tests/integration/database/test_performance_alerts.py +++ b/tests/integration/database/test_performance_alerts.py @@ -277,7 +277,13 @@ async def test_retries_status_changes_deletion_and_reconnect_do_not_restore_allo async def test_opt_out_is_shared_and_config_false_cannot_be_overridden(fixture: Fixture, gateway: Gateway) -> None: response: Final = gateway.request("GET", "/alerts/monitoring") assert response.status_code == 200, response.text - assert response.json() == {"enabled": True, "alerts_used": 0, "alert_limit": 5, "disabled_by_config": False} + assert response.json() == { + "enabled": True, + "model_deprecations_enabled": True, + "alerts_used": 0, + "alert_limit": None if os.environ.get("LITELLM_LICENSE") else FREE_ALERT_LIMIT, + "disabled_by_config": False, + } claim: Final = await fixture.repository.claim(timedelta(0)) assert claim is not None disabled: Final = gateway.request("PATCH", "/alerts/monitoring", {"enabled": False}) diff --git a/tests/integration/database/test_request_log_indexes_at_boot.py b/tests/integration/database/test_request_log_indexes_at_boot.py index afcd1a34b7d..278394328bc 100644 --- a/tests/integration/database/test_request_log_indexes_at_boot.py +++ b/tests/integration/database/test_request_log_indexes_at_boot.py @@ -1,4 +1,5 @@ import os +import re import shutil import subprocess import sys @@ -14,6 +15,7 @@ import pytest from integration._support.client import Gateway, eventually from integration._support.database import scratch_database from integration._support.process import LEGACY_MIGRATE_DEPLOY, MIGRATE_DEPLOY, owned_proxy_process +from litellm_proxy_extras.request_log_indexes import REQUEST_LOG_INDEXES from psycopg import sql from psycopg.rows import class_row @@ -44,6 +46,7 @@ INDEXES_IN_PLACE: Final = "Request-log indexes are all in place" INDEX_BUILD_LINES: Final = ("Building index", "Attached index") BUILD_SECONDS: Final = 60 SPEND_LOGS_INDEXES: Final = ("LiteLLM_SpendLogs_api_key_startTime_idx", "LiteLLM_SpendLogs_litellm_call_id_idx") +JOB_ONLY_INDEXES: Final = tuple(index.name for index in REQUEST_LOG_INDEXES if index.name not in SPEND_LOGS_INDEXES) POPULATED_PARTITIONS: Final = MappingProxyType( { "LiteLLM_SpendLogs_p2026_08": ("2026-08-01", "2026-09-01"), @@ -325,7 +328,8 @@ def test_the_migration_job_leaves_a_plain_table_that_applied_the_original_index_ job: Final = migration_job(database_url, resolver) assert job.returncode == 0, job.stdout + job.stderr assert INDEXES_IN_PLACE in job.stderr + job.stdout, job.stdout + job.stderr - assert "Building index" not in job.stderr + job.stdout, job.stdout + job.stderr + built: Final = re.findall(r"Building index (\S+) on ", job.stderr + job.stdout) + assert built == list(JOB_ONLY_INDEXES), job.stdout + job.stderr assert ledger(database_url) == {name: True for name in SHIPPED_MIGRATIONS} assert index_oids(database_url) == before assert_the_serving_proxy_boots_and_finds_the_indexes_in_place(gateway, tmp_path, database_url, resolver) diff --git a/tests/integration/observability/test_logging_only_scope_runtime.py b/tests/integration/observability/test_logging_only_scope_runtime.py index 271d8d0e24d..21547800281 100644 --- a/tests/integration/observability/test_logging_only_scope_runtime.py +++ b/tests/integration/observability/test_logging_only_scope_runtime.py @@ -842,12 +842,15 @@ def test_logging_only_scope_respects_guardrail_selection_level( api_base=f"{upstream_handle.api_base()}/v1", api_key="synthetic-provider-key", ) - key: Final = ( - scenario.key(metadata={"guardrails": [identity]}) if selection == "virtual-key" else gateway.key - ) with wire_server(policy) as guardrail: config: Final = _configuration(tmp_path, identity, guardrail.url, scope, default_on=False) - with owned_proxy(gateway, tmp_path, {}, config=config, workers=1) as candidate: + with ( + owned_proxy(gateway, tmp_path, {}, config=config, workers=1) as candidate, + candidate.scenario() as owned, + ): + key: Final = ( + owned.key(metadata={"guardrails": [identity]}) if selection == "virtual-key" else gateway.key + ) request_body: Final[dict[str, JsonValue]] = { "model": model, "messages": [{"role": "user", "content": prompt}],