From 67dd8924eead7d757addd7bca9fb123bc76a39f4 Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Sat, 1 Aug 2026 14:36:30 -0700 Subject: [PATCH] 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. --- tests/local_testing/test_config.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/local_testing/test_config.py b/tests/local_testing/test_config.py index e4d0ffb4408..0c4c1a39b98 100644 --- a/tests/local_testing/test_config.py +++ b/tests/local_testing/test_config.py @@ -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(