From f3e2167730a99b1d378315c9fc3feb283a5cf84f Mon Sep 17 00:00:00 2001 From: Mateo Wang <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 3 Jun 2026 10:17:38 -0700 Subject: [PATCH] test(pass-through): move Gemini pass-through tests to gemini-3.1-flash-lite (#29595) * test(pass-through): move Gemini pass-through tests to gemini-3.1-flash-lite gemini-2.5-flash-lite is a generation behind and is slated for discontinuation on Vertex AI no earlier than October 16, 2026, so the pass-through suite was exercising an aging model. Every reference now points at gemini-3.1-flash-lite, which is GA and already priced in the cost map so the spend-logging assertions still compute a real cost test_vertex.test.js also gains jest.retryTimes(3) to match the sibling spend tests. The CI failures were intermittent 429 RESOURCE_EXHAUSTED from Vertex quota pressure, and that file was the only one without a retry, so a single rate-limited request was failing the whole job * test(pass-through): point Vertex tests at the global endpoint for gemini-3.1-flash-lite gemini-3.1-flash-lite is not served on the Vertex us-central1 regional endpoint for the CI project, so the Vertex pass-through tests were returning a deterministic 404 "Publisher Model ... was not found or your project does not have access to it" while the Gemini API tests passed. Move the Vertex clients to the global location, which the pass-through router maps to aiplatform.googleapis.com, where the 3.1 family is served --- .../test_gemini_with_spend.test.js | 4 ++-- tests/pass_through_tests/test_local_gemini.js | 4 ++-- tests/pass_through_tests/test_local_vertex.js | 4 ++-- tests/pass_through_tests/test_vertex.test.js | 11 +++++++---- tests/pass_through_tests/test_vertex_ai.py | 12 ++++++------ .../test_vertex_with_spend.test.js | 8 ++++---- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/tests/pass_through_tests/test_gemini_with_spend.test.js b/tests/pass_through_tests/test_gemini_with_spend.test.js index 989bbc4b8e..b9a25d3a3e 100644 --- a/tests/pass_through_tests/test_gemini_with_spend.test.js +++ b/tests/pass_through_tests/test_gemini_with_spend.test.js @@ -32,7 +32,7 @@ describe('Gemini AI Tests', () => { }; const model = genAI.getGenerativeModel({ - model: 'gemini-2.5-flash-lite' + model: 'gemini-3.1-flash-lite' }, requestOptions); const prompt = 'Say "hello test" and nothing else'; @@ -83,7 +83,7 @@ describe('Gemini AI Tests', () => { }; const model = genAI.getGenerativeModel({ - model: 'gemini-2.5-flash-lite' + model: 'gemini-3.1-flash-lite' }, requestOptions); const prompt = 'Say "hello test" and nothing else'; diff --git a/tests/pass_through_tests/test_local_gemini.js b/tests/pass_through_tests/test_local_gemini.js index 0a72ca5cd7..dc033a51f1 100644 --- a/tests/pass_through_tests/test_local_gemini.js +++ b/tests/pass_through_tests/test_local_gemini.js @@ -1,13 +1,13 @@ const { GoogleGenerativeAI, ModelParams, RequestOptions } = require("@google/generative-ai"); const modelParams = { - model: 'gemini-2.5-flash-lite', + model: 'gemini-3.1-flash-lite', }; const requestOptions = { baseUrl: 'http://127.0.0.1:4000/gemini', customHeaders: { - "tags": "gemini-js-sdk,gemini-2.5-flash-lite" + "tags": "gemini-js-sdk,gemini-3.1-flash-lite" } }; diff --git a/tests/pass_through_tests/test_local_vertex.js b/tests/pass_through_tests/test_local_vertex.js index 149635e2d6..7cfe31db95 100644 --- a/tests/pass_through_tests/test_local_vertex.js +++ b/tests/pass_through_tests/test_local_vertex.js @@ -4,7 +4,7 @@ const { VertexAI, RequestOptions } = require('@google-cloud/vertexai'); const vertexAI = new VertexAI({ project: 'litellm-ci-cd', - location: 'us-central1', + location: 'global', apiEndpoint: "127.0.0.1:4000/vertex-ai" }); @@ -20,7 +20,7 @@ const requestOptions = { }; const generativeModel = vertexAI.getGenerativeModel( - { model: 'gemini-2.5-flash-lite' }, + { model: 'gemini-3.1-flash-lite' }, requestOptions ); diff --git a/tests/pass_through_tests/test_vertex.test.js b/tests/pass_through_tests/test_vertex.test.js index 7b5edf6acd..e0e879c289 100644 --- a/tests/pass_through_tests/test_vertex.test.js +++ b/tests/pass_through_tests/test_vertex.test.js @@ -56,6 +56,9 @@ beforeAll(() => { loadVertexAiCredentials(); }); +// Configure Jest to retry flaky tests up to 3 times (useful for 429 rate limiting) +jest.retryTimes(3); + // Non-streaming Vertex generateContent can exceed 5s in CI / under load const VERTEX_TEST_TIMEOUT_MS = 30000; @@ -65,7 +68,7 @@ describe('Vertex AI Tests', () => { async () => { const vertexAI = new VertexAI({ project: 'litellm-ci-cd', - location: 'us-central1', + location: 'global', apiEndpoint: "localhost:4000/vertex-ai" }); @@ -78,7 +81,7 @@ describe('Vertex AI Tests', () => { }; const generativeModel = vertexAI.getGenerativeModel( - { model: 'gemini-2.5-flash-lite' }, + { model: 'gemini-3.1-flash-lite' }, requestOptions ); @@ -108,13 +111,13 @@ describe('Vertex AI Tests', () => { async () => { const vertexAI = new VertexAI({ project: 'litellm-ci-cd', - location: 'us-central1', + location: 'global', apiEndpoint: "localhost:4000/vertex-ai" }); const customHeaders = new Headers({"x-litellm-api-key": "sk-1234"}); const requestOptions = {customHeaders: customHeaders}; const generativeModel = vertexAI.getGenerativeModel( - {model: 'gemini-2.5-flash-lite'}, + {model: 'gemini-3.1-flash-lite'}, requestOptions ); const request = {contents: [{role: 'user', parts: [{text: 'What is 2+2?'}]}]}; diff --git a/tests/pass_through_tests/test_vertex_ai.py b/tests/pass_through_tests/test_vertex_ai.py index 73bf03c500..bf1200489a 100644 --- a/tests/pass_through_tests/test_vertex_ai.py +++ b/tests/pass_through_tests/test_vertex_ai.py @@ -103,12 +103,12 @@ async def test_basic_vertex_ai_pass_through_with_spendlog(): vertexai.init( project="litellm-ci-cd", - location="us-central1", + location="global", api_endpoint=f"{LITE_LLM_ENDPOINT}/vertex_ai", api_transport="rest", ) - model = GenerativeModel(model_name="gemini-2.5-flash-lite") + model = GenerativeModel(model_name="gemini-3.1-flash-lite") response = model.generate_content("hi") print("response", response) @@ -143,12 +143,12 @@ async def test_basic_vertex_ai_pass_through_streaming_with_spendlog(): vertexai.init( project="litellm-ci-cd", - location="us-central1", + location="global", api_endpoint=f"{LITE_LLM_ENDPOINT}/vertex_ai", api_transport="rest", ) - model = GenerativeModel(model_name="gemini-2.5-flash-lite") + model = GenerativeModel(model_name="gemini-3.1-flash-lite") response = model.generate_content("hi", stream=True) for chunk in response: @@ -182,7 +182,7 @@ async def test_vertex_ai_pass_through_endpoint_context_caching(): vertexai.init( project="litellm-ci-cd", - location="us-central1", + location="global", api_endpoint=f"{LITE_LLM_ENDPOINT}/vertex_ai", api_transport="rest", ) @@ -204,7 +204,7 @@ async def test_vertex_ai_pass_through_endpoint_context_caching(): ] cached_content = caching.CachedContent.create( - model_name="gemini-2.5-flash-lite-001", + model_name="gemini-3.1-flash-lite", system_instruction=system_instruction, contents=contents, ttl=datetime.timedelta(minutes=60), diff --git a/tests/pass_through_tests/test_vertex_with_spend.test.js b/tests/pass_through_tests/test_vertex_with_spend.test.js index 142a1cec8f..4dee890dc7 100644 --- a/tests/pass_through_tests/test_vertex_with_spend.test.js +++ b/tests/pass_through_tests/test_vertex_with_spend.test.js @@ -71,7 +71,7 @@ describe('Vertex AI Tests', () => { test('should successfully generate non-streaming content with tags', async () => { const vertexAI = new VertexAI({ project: 'litellm-ci-cd', - location: 'us-central1', + location: 'global', apiEndpoint: "127.0.0.1:4000/vertex_ai" }); @@ -85,7 +85,7 @@ describe('Vertex AI Tests', () => { }; const generativeModel = vertexAI.getGenerativeModel( - { model: 'gemini-2.5-flash-lite' }, + { model: 'gemini-3.1-flash-lite' }, requestOptions ); @@ -130,7 +130,7 @@ describe('Vertex AI Tests', () => { test('should successfully generate streaming content with tags', async () => { const vertexAI = new VertexAI({ project: 'litellm-ci-cd', - location: 'us-central1', + location: 'global', apiEndpoint: "127.0.0.1:4000/vertex_ai" }); @@ -144,7 +144,7 @@ describe('Vertex AI Tests', () => { }; const generativeModel = vertexAI.getGenerativeModel( - { model: 'gemini-2.5-flash-lite' }, + { model: 'gemini-3.1-flash-lite' }, requestOptions );