From c2b2668d7af3f7047c8249e7b620fec4874e3ccc Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Thu, 2 Apr 2026 20:12:15 +0530 Subject: [PATCH] fix(tests+docs): fix tuple unpacking and docs test failures - Update test mocks that return (healthy, unhealthy) to return (healthy, unhealthy, {}) to match the new 3-value signature - Update test unpackings of perform_shared_health_check to use healthy, unhealthy, _ = ... - Add health_check_ignore_transient_errors to router_settings section in config_settings.md (it is a Router constructor param, so the doc test requires it there; it also lives in general_settings for proxy use) Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/my-website/docs/proxy/config_settings.md | 1 + tests/proxy_unit_tests/test_proxy_server.py | 4 ++-- .../proxy/test_health_check_functions.py | 2 +- tests/test_litellm/proxy/test_shared_health_check.py | 12 ++++++------ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index 1e4e01ffb2d..846f7641960 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -397,6 +397,7 @@ router_settings: | guardrail_list | List[GuardrailTypedDict] | List of guardrail configurations for guardrail load balancing. Enables load balancing across multiple guardrail deployments with the same guardrail_name. [Further Docs](./guardrails/guardrail_load_balancing.md) | | enable_health_check_routing | boolean | If true, enables health check-driven deployment filtering to avoid routing requests to unhealthy deployments | | health_check_staleness_threshold | integer | Maximum age in seconds for cached health check results before marking deployments as stale | +| health_check_ignore_transient_errors | boolean | If true, 429 (rate limit) and 408 (timeout) health check failures are ignored and do not affect routing or cooldown | ### environment variables - Reference diff --git a/tests/proxy_unit_tests/test_proxy_server.py b/tests/proxy_unit_tests/test_proxy_server.py index 61a2f3055af..cb519b76211 100644 --- a/tests/proxy_unit_tests/test_proxy_server.py +++ b/tests/proxy_unit_tests/test_proxy_server.py @@ -2410,7 +2410,7 @@ async def test_run_background_health_check_reflects_llm_model_list(monkeypatch): model_list, details, max_concurrency=None ): called_model_lists.append(copy.deepcopy(model_list)) - return (["healthy"], ["unhealthy"]) + return (["healthy"], ["unhealthy"], {}) monkeypatch.setattr(proxy_server, "health_check_interval", 1) monkeypatch.setattr(proxy_server, "health_check_details", None) @@ -2460,7 +2460,7 @@ async def test_background_health_check_skip_disabled_models(monkeypatch): model_list, details, max_concurrency=None ): called_model_lists.append(copy.deepcopy(model_list)) - return (["healthy"], []) + return (["healthy"], [], {}) monkeypatch.setattr(proxy_server, "health_check_interval", 1) monkeypatch.setattr(proxy_server, "health_check_details", None) diff --git a/tests/test_litellm/proxy/test_health_check_functions.py b/tests/test_litellm/proxy/test_health_check_functions.py index 354698b02fe..13d2131efad 100644 --- a/tests/test_litellm/proxy/test_health_check_functions.py +++ b/tests/test_litellm/proxy/test_health_check_functions.py @@ -481,7 +481,7 @@ async def test_perform_health_check_and_save_passes_model_id_to_perform_health_c unhealthy = [] async def mock_perform_health_check(model_list, model=None, cli_model=None, details=True, model_id=None, max_concurrency=None): - return healthy, unhealthy + return healthy, unhealthy, {} with patch( "litellm.proxy.health_endpoints._health_endpoints.perform_health_check", diff --git a/tests/test_litellm/proxy/test_shared_health_check.py b/tests/test_litellm/proxy/test_shared_health_check.py index 0212d87baab..20c96c8152d 100644 --- a/tests/test_litellm/proxy/test_shared_health_check.py +++ b/tests/test_litellm/proxy/test_shared_health_check.py @@ -246,7 +246,7 @@ class TestSharedHealthCheckManager: model_list = [{"model_name": "test-model", "litellm_params": {"model": "test-model"}}] with patch("litellm.proxy.health_check_utils.shared_health_check_manager.perform_health_check") as mock_perform: - healthy, unhealthy = await shared_health_manager.perform_shared_health_check( + healthy, unhealthy, _ = await shared_health_manager.perform_shared_health_check( model_list, details=True ) @@ -268,9 +268,9 @@ class TestSharedHealthCheckManager: expected_unhealthy = [] with patch("litellm.proxy.health_check_utils.shared_health_check_manager.perform_health_check") as mock_perform: - mock_perform.return_value = (expected_healthy, expected_unhealthy) + mock_perform.return_value = (expected_healthy, expected_unhealthy, {}) - healthy, unhealthy = await shared_health_manager.perform_shared_health_check( + healthy, unhealthy, _ = await shared_health_manager.perform_shared_health_check( model_list, details=True ) @@ -302,7 +302,7 @@ class TestSharedHealthCheckManager: model_list = [{"model_name": "test-model", "litellm_params": {"model": "test-model"}}] with patch("asyncio.sleep") as mock_sleep: # Mock sleep to avoid actual delay - healthy, unhealthy = await shared_health_manager.perform_shared_health_check( + healthy, unhealthy, _ = await shared_health_manager.perform_shared_health_check( model_list, details=True ) @@ -324,9 +324,9 @@ class TestSharedHealthCheckManager: with patch("asyncio.sleep") as mock_sleep, \ patch("litellm.proxy.health_check_utils.shared_health_check_manager.perform_health_check") as mock_perform: - mock_perform.return_value = (expected_healthy, expected_unhealthy) + mock_perform.return_value = (expected_healthy, expected_unhealthy, {}) - healthy, unhealthy = await shared_health_manager.perform_shared_health_check( + healthy, unhealthy, _ = await shared_health_manager.perform_shared_health_check( model_list, details=True )