Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

ci: install the mongodb extra for the unit test shard that runs the provider

Yuneng Jiang3d0223b66122
diff --git a/.github/workflows/_test-unit-base.yml b/.github/workflows/_test-unit-base.yml
index c4045a08ffb..80d743c5ad7 100644
--- a/.github/workflows/_test-unit-base.yml
+++ b/.github/workflows/_test-unit-base.yml
@@ -112,7 +112,7 @@ jobs:
if: steps.changes.outputs.decision != 'skip'
timeout-minutes: 8
run: |
- .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml
+ .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml --extra mongodb
- name: Cache Prisma binaries
if: steps.changes.outputs.decision != 'skip'
diff --git a/tests/test_litellm/llms/mongodb/vector_stores/test_mongodb_transformation.py b/tests/test_litellm/llms/mongodb/vector_stores/test_mongodb_transformation.py
index e7ed3d77407..0e62e7c11d6 100644
--- a/tests/test_litellm/llms/mongodb/vector_stores/test_mongodb_transformation.py
+++ b/tests/test_litellm/llms/mongodb/vector_stores/test_mongodb_transformation.py
@@ -658,6 +658,19 @@ class TestClientKeyDerivation:
assert key.socket_timeout_ms == 3_000
assert key.connect_timeout_ms == 3_000
+ def test_a_short_timeout_also_shortens_server_selection(self):
+ """Server selection runs before the connect attempt, so leaving it at the 10s default
+ would let a caller asking for a 3s budget block for 10s before anything is tried."""
+ key = MongoDBVectorStoreConfig._client_key(_MongoDBSearchParams.model_validate(BASE_PARAMS), 3.0)
+
+ assert key.server_selection_timeout_ms == 3_000
+
+ def test_a_generous_timeout_does_not_raise_server_selection_above_the_default(self):
+ key = MongoDBVectorStoreConfig._client_key(_MongoDBSearchParams.model_validate(BASE_PARAMS), 120.0)
+
+ assert key.socket_timeout_ms == 120_000
+ assert key.server_selection_timeout_ms == 10_000
+
def test_an_httpx_timeout_maps_connect_and_read_separately(self):
key = MongoDBVectorStoreConfig._client_key(
_MongoDBSearchParams.model_validate(BASE_PARAMS), httpx.Timeout(connect=2.0, read=45.0, write=5.0, pool=5.0)
@@ -693,6 +706,16 @@ class TestErrorTranslation:
assert "sample_mflix.embedded_movies" in str(translated)
+ def test_code_13_alone_is_enough_without_a_recognisable_message(self):
+ """The other unauthorized case carries "not authorized", which the message markers also
+ match, so it cannot tell whether the code is still being checked at all."""
+ from pymongo.errors import OperationFailure
+
+ translated = self._translate(OperationFailure("user lacks privileges on this namespace", code=13))
+
+ assert "rejected the credentials" in str(translated)
+ assert "sample_mflix.embedded_movies" in str(translated)
+
def test_a_missing_index_names_the_index_and_the_collection(self):
from pymongo.errors import OperationFailure