From 78e5a0a738cc910d02590e9a994d0d8dab559483 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 20 Oct 2026 18:43:14 -0700 Subject: [PATCH] test(proxy): pin the mapped Azure AI Search index on index delete and document-key paths --- .../test_llm_pass_through_endpoints.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/unit/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py b/tests/unit/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py index 16abeb3dda4..cbebb615bf3 100644 --- a/tests/unit/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py +++ b/tests/unit/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py @@ -5622,6 +5622,13 @@ DEVELOPER_KEY_ON_VIRTUAL_INDEX: Final = UserAPIKeyAuth( ), ("GET", "indexes/virtual-idx/docs/$count", None, "/indexes/real-idx/docs/$count"), ("GET", "indexes/virtual-idx", None, "/indexes/real-idx"), + ("GET", "indexes/virtual-idx/docs/virtual-idx", None, "/indexes/real-idx/docs/virtual-idx"), + ( + "POST", + "indexes/virtual-idx/docs/search", + {"search": "*", "name": "virtual-idx"}, + "/indexes/real-idx/docs/search", + ), ], ) def test_azure_ai_search_virtual_index_reaches_azure_as_the_mapped_index( @@ -5670,6 +5677,21 @@ def test_azure_ai_search_index_definition_put_names_the_mapped_index( assert json.loads(sent.content) == {"name": upstream_name, "fields": fields} + +def test_azure_ai_search_index_delete_on_the_virtual_index_deletes_the_mapped_index( + azure_ai_search_virtual_index_client: Callable[[UserAPIKeyAuth], TestClient], +) -> None: + client: Final = azure_ai_search_virtual_index_client( + UserAPIKeyAuth(api_key="sk-admin", user_role=LitellmUserRoles.PROXY_ADMIN) + ) + with respx.mock(assert_all_called=True) as upstream: + azure: Final = upstream.route(host="svc.search.windows.net").mock(return_value=httpx.Response(204)) + response: Final = client.delete("/azure_ai/indexes/virtual-idx?api-version=2024-07-01") + + assert response.status_code == 204 + sent: Final = azure.calls.last.request + assert (sent.method, sent.url.path, sent.headers["api-key"]) == ("DELETE", "/indexes/real-idx", "search-admin-key") + class TestAzureProxyRouteServiceLevelIndexCreate: """``POST /indexes`` carries no index name, so the managed-index branch cannot claim it and it would otherwise reach the generic Azure passthrough on the