test(proxy): assert _delete_deployment's still-desired id set instead of a delete count

_delete_deployment stopped returning a count of evictions in #35400 and now returns
the frozenset of ids the db and config still want, so a caller judging its own reload
can tell a deliberate eviction from a deployment that went missing. These two tests in
tests/local_testing were left comparing that frozenset against an int and have been
failing since; the directory is only referenced by .circleci/config.yml, which no
longer reports checks on PRs, so nothing caught them.

The eviction behavior itself is unchanged, so the fix is on the assertions: compare
against the expected id set, and pin the router's surviving ids so a mutation that
evicts the wrong deployment is caught rather than passing a bare length check.
This commit is contained in:
Yuneng Jiang 2026-08-01 14:36:30 -07:00
parent b1fd20f4cd
commit 67dd8924ee
No known key found for this signature in database

View file

@ -88,10 +88,11 @@ async def test_delete_deployment():
)
db_models = [db_model]
deleted_deployments = await pc._delete_deployment(db_models=db_models)
still_desired = await pc._delete_deployment(db_models=db_models)
assert deleted_deployments == 1
assert still_desired == frozenset({deployment.model_info.id})
assert len(llm_router.model_list) == 1
assert llm_router.get_model_ids() == [deployment.model_info.id]
"""
Scenario 2 - if model id != model_info["id"]
@ -115,10 +116,11 @@ async def test_delete_deployment():
)
db_models = [db_model]
deleted_deployments = await pc._delete_deployment(db_models=db_models)
still_desired = await pc._delete_deployment(db_models=db_models)
assert deleted_deployments == 1
assert still_desired == frozenset({deployment.model_info.id})
assert len(llm_router.model_list) == 1
assert llm_router.get_model_ids() == [deployment.model_info.id]
@pytest.mark.asyncio
@ -239,10 +241,16 @@ async def test_db_error_new_model_check():
new=AsyncMock(return_value={"model_list": config_model_list}),
):
db_models = []
deleted_deployments = await pc._delete_deployment(db_models=db_models)
assert deleted_deployments == 0
still_desired = await pc._delete_deployment(db_models=db_models)
assert still_desired == frozenset(
{deployment.model_info.id, deployment_2.model_info.id}
)
assert init_len_list == len(llm_router.model_list)
assert set(llm_router.get_model_ids()) == {
deployment.model_info.id,
deployment_2.model_info.id,
}
litellm_params = LiteLLM_Params(