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

tests/test_litellm/llms/mongodb imports pymongo's exception classes to check the
error translation against the real hierarchy, and the shard that runs it
(tests/test_litellm/llms, per test-unit.yml) synced --extra google, proxy,
semantic-router and saml but not mongodb, so 24 of 109 tests would have errored
with ModuleNotFoundError on the first CI run. CircleCI hid this because it syncs
--all-groups --all-extras.

  uv export --frozen ... --extra saml                  -> no pymongo
  uv export --frozen ... --extra saml --extra mongodb  -> pymongo==4.17.0

Also close the two gaps a mutation run found in the suite: nothing asserted that
a short request timeout shortens server selection as well as connect, and the
existing code 13 case carried "not authorized", which the message markers match
too, so it could not tell whether the code was still being checked. 28 of 28
mutants now die.
This commit is contained in:
Yuneng Jiang 2026-09-02 12:51:19 -07:00
parent 517e508700
commit 3d0223b661
2 changed files with 24 additions and 1 deletions

View file

@ -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'

View file

@ -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