Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/scripts/unit_selection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ legacy_paths() {
echo tests/unit/proxy/google_endpoints/test_google_endpoint_routing.py
echo tests/unit/proxy/google_endpoints/test_google_gemini_proxy_request.py
echo tests/unit/proxy/public_endpoints/test_blog_posts_endpoint.py
echo tests/unit/proxy/response_polling/test_response_polling_handler.py
echo tests/unit/proxy/response_polling
echo tests/unit/proxy/test_custom_tokenizer_bug.py
echo tests/unit/proxy/test_get_favicon.py
echo tests/unit/proxy/test_get_image.py
Expand Down Expand Up @@ -151,6 +151,7 @@ legacy_paths() {
proxy-extras) echo tests/unit/litellm_proxy_extras ;;
proxy-infra)
echo tests/unit/gateway
echo tests/unit/proxy/management
echo tests/unit/proxy/management_endpoints/test_roi_calculator_endpoints.py
echo tests/unit/proxy/roi_calculator ;;
responses-caching-types)
Expand Down
48 changes: 43 additions & 5 deletions .github/scripts/assert_ci_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import warnings
from collections.abc import Callable, Iterable, Mapping, Sequence
from dataclasses import dataclass
from types import MappingProxyType
from typing import Final

import yaml
Expand All @@ -35,7 +36,7 @@
# itself decomposed one level deeper and is checked through its own entry.
SHARDED_ROOTS: tuple[str, ...] = (
"tests/test_litellm",
"tests/test_litellm/proxy",
"tests/unit/proxy",
)


Expand Down Expand Up @@ -119,11 +120,48 @@ def _invoked_test_tokens(scalars: Iterable[Scalar]) -> frozenset[str]:
)


def _unit_selection_tokens(repo_root: pathlib.Path = REPO_ROOT) -> frozenset[str]:
SELECTION_ARM_RE = re.compile(r"(?ms)^\s*([A-Za-z0-9_|*-]+)\)\s*(.*?);;")


def _unit_selection_arms(repo_root: pathlib.Path = REPO_ROOT) -> Mapping[str, frozenset[str]]:
script: Final = repo_root / ".circleci/scripts/unit_selection.sh"
if not script.is_file():
return frozenset()
return frozenset(match.group(0).rstrip("/") for match in TEST_TOKEN_RE.finditer(_uncommented(script.read_text())))
return MappingProxyType({})
text: Final = _uncommented(script.read_text())
return MappingProxyType(
{
label: frozenset(
match.group(0).rstrip("/") for match in TEST_TOKEN_RE.finditer(body)
)
for label, body in SELECTION_ARM_RE.findall(text)
}
)


def _unit_selection_tokens(repo_root: pathlib.Path = REPO_ROOT) -> frozenset[str]:
return frozenset(
token for tokens in _unit_selection_arms(repo_root).values() for token in tokens
)


def _wired_unit_flags(scalars: Iterable[Scalar]) -> frozenset[str]:
return frozenset(
scalar.value
for scalar in scalars
if scalar.key == "unit-flag" and "${{" not in scalar.value
)


def _shard_tokens(
scalars: Iterable[Scalar], arms: Mapping[str, frozenset[str]]
) -> frozenset[str]:
wired: Final = _wired_unit_flags(scalars)
return _invoked_test_tokens(scalars) | frozenset(
token
for label, tokens in arms.items()
if label in wired
for token in tokens
)


def _built_dockerfile_tokens(scalars: Iterable[Scalar]) -> frozenset[str]:
Expand Down Expand Up @@ -480,7 +518,7 @@ def _check_slices() -> int:


def _check_shards() -> int:
findings = _unassigned_shard_children(_invoked_test_tokens(_all_scalars()))
findings = _unassigned_shard_children(_shard_tokens(_all_scalars(), _unit_selection_arms()))
if findings:
_report(
"test directories and files that no shard claims",
Expand Down
116 changes: 34 additions & 82 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ jobs:
tests/unit/proxy/spend_tracking
--ignore=tests/unit/proxy/spend_tracking/test_search_api_logging.py
tests/unit/proxy/pass_through_endpoints
tests/test_litellm/proxy/pass_through_endpoints
tests/unit/proxy/_experimental
--ignore=tests/unit/proxy/_experimental/mcp_server
tests/unit/proxy/experimental
Expand All @@ -217,93 +216,46 @@ jobs:
tests/unit/proxy/enterprise_billing
tests/unit/proxy/types_utils
tests/unit/proxy/logging_endpoints
tests/unit/proxy/test__types.py
tests/unit/proxy/test_aiohttp_cleanup_closed.py
tests/unit/proxy/test_aiohttp_session_recovery.py
tests/unit/proxy/test_api_key_masking_in_errors.py
tests/unit/proxy/test_audio_speech_prometheus_hooks.py
tests/unit/proxy/test_batch_expiry.py
tests/unit/proxy/test_batch_metadata_none_fix.py
tests/unit/proxy/test_batch_retrieve_bedrock.py
tests/unit/proxy/test_batch_x_litellm_model_encoding.py
tests/unit/proxy/test_blocked_response_usage.py
tests/unit/proxy/test_body_snapshot_callback_params.py
tests/unit/proxy/test_budget_reservation.py
tests/unit/proxy/test_bug_report_config.py
tests/unit/proxy/test_caching_routes.py
tests/unit/proxy/test_chat_completion_metadata.py
tests/unit/proxy/test_claude_code_marketplace.py
tests/unit/proxy/test_collector.py
tests/unit/proxy/test_common_request_processing.py
tests/unit/proxy/test_component_allowlists.py
tests/unit/proxy/test_conftest.py
tests/unit/proxy/test_cors_config.py
tests/unit/proxy/test_custom_proxy.py
tests/unit/proxy/test_dynamic_mcp_route.py
tests/unit/proxy/test_empty_model_list.py
tests/unit/proxy/test_enforce_user_param.py
tests/unit/proxy/test_fallback_management_endpoints.py
tests/unit/proxy/test_fastapi_offline_routes.py
tests/unit/proxy/test_filter_models_by_team_access_group.py
tests/unit/proxy/test_health_check_functions.py
tests/unit/proxy/test_health_check_max_tokens.py
tests/unit/proxy/test_init_litellm_callbacks.py
tests/unit/proxy/test_langfuse_passthrough_security.py
tests/unit/proxy/test_lazy_openapi_snapshot.py
tests/unit/proxy/test_litellm_pre_call_utils.py
tests/unit/proxy/test_max_budget_env_var.py
tests/unit/proxy/test_mcp_asgi_response.py
tests/unit/proxy/test_model_based_routing_files_batches.py
tests/unit/proxy/test_model_deprecations_endpoint.py
tests/unit/proxy/test_model_dump_with_preserved_fields.py
tests/unit/proxy/test_model_id_header_propagation.py
tests/unit/proxy/test_model_info_default_limits.py
tests/unit/proxy/test_model_level_guardrails.py
tests/unit/proxy/test_model_list_aliases.py
tests/unit/proxy/test_model_list_callback_filter.py
tests/unit/proxy/test_model_list_discoverable.py
tests/unit/proxy/test_model_list_healthy_only.py
tests/unit/proxy/test_modify_response_streaming_passthrough.py
tests/unit/proxy/test_native_compaction.py
tests/unit/proxy/test_openai_ws_passthrough_routes.py
tests/unit/proxy/test_openapi_schema_validation.py
tests/unit/proxy/test_plugin_routes.py
tests/unit/proxy/test_pointfive_dashboard_config.py
tests/unit/proxy/test_pointfive_ui_callback.py
tests/unit/proxy/test_pricing_field_strip.py
tests/unit/proxy/test_prisma_engine_watchdog.py
tests/unit/proxy/test_prisma_migration.py
tests/unit/proxy/test_prometheus_cleanup.py
tests/unit/proxy/test_prometheus_metrics_server.py
tests/unit/proxy/test_provider_url_destination_guard.py
tests/unit/proxy/test_proxy_cli.py
tests/unit/proxy/test_proxy_logging_hook_detection.py
tests/unit/proxy/test_proxy_types.py
tests/unit/proxy/test_pyroscope.py
tests/unit/proxy/test_read_model_list.py
tests/unit/proxy/test_redis_auth_cache_flag.py
tests/unit/proxy/test_response_model_sanitization.py
tests/unit/proxy/test_route_a2a_models.py
tests/unit/proxy/test_route_llm_request.py
tests/unit/proxy/test_route_priority.py
tests/unit/proxy/test_sensitive_route_auth.py
tests/unit/proxy/test_shared_health_check.py
tests/unit/proxy/test_spend_log_cleanup.py
tests/unit/proxy/test_swagger_chat_completions.py
tests/unit/proxy/test_team_member_update.py
tests/unit/proxy/test_team_org_move.py
tests/unit/proxy/test_tools_allowlist_enforcement.py
tests/unit/proxy/test_tracing_endpoints.py
tests/unit/proxy/test_update_llm_router_resilience.py
tests/unit/proxy/test_zerobus_dashboard_config.py
tests/unit/proxy/test_proxy_server_endpoints_and_startup.py
tests/unit/proxy/test_proxy_utils_model_creation_and_error_logging.py
unit-flag: proxy-infra
workers: 4
reruns: 2
timeout-minutes: 20
job-timeout-minutes: 60

- shard: proxy-infra-root
artifact-name: proxy-infra-root
test-path: >-
tests/unit/proxy/test_*.py
--ignore=tests/unit/proxy/test_aproxy_startup.py
--ignore=tests/unit/proxy/test_credential_slot_registry.py
--ignore=tests/unit/proxy/test_custom_callback_input.py
--ignore=tests/unit/proxy/test_custom_logger_s3_gcs.py
--ignore=tests/unit/proxy/test_custom_tokenizer_bug.py
--ignore=tests/unit/proxy/test_db_schema_changes.py
--ignore=tests/unit/proxy/test_deprecated_key_grace_period.py
--ignore=tests/unit/proxy/test_get_favicon.py
--ignore=tests/unit/proxy/test_get_image.py
--ignore=tests/unit/proxy/test_prisma_client_backoff_retry.py
--ignore=tests/unit/proxy/test_prompt_test_endpoint.py
--ignore=tests/unit/proxy/test_proxy_config_unit_test.py
--ignore=tests/unit/proxy/test_proxy_custom_auth.py
--ignore=tests/unit/proxy/test_proxy_reject_logging.py
--ignore=tests/unit/proxy/test_proxy_server.py
--ignore=tests/unit/proxy/test_proxy_setting_guardrails.py
--ignore=tests/unit/proxy/test_proxy_token_counter.py
--ignore=tests/unit/proxy/test_proxy_utils.py
--ignore=tests/unit/proxy/test_reducto_ocr_route.py
--ignore=tests/unit/proxy/test_response_polling_pre_call_checks.py
--ignore=tests/unit/proxy/test_server_root_path.py
--ignore=tests/unit/proxy/test_ui_path_detection.py
--ignore=tests/unit/proxy/test_unit_test_proxy_hooks.py
--ignore=tests/unit/proxy/test_update_spend.py
--ignore=tests/unit/proxy/test_zero_cost_model_budget_bypass.py
workers: 4
reruns: 2
timeout-minutes: 20
job-timeout-minutes: 60

- shard: caching-local
artifact-name: caching-local
test-path: ""
Expand Down
Loading
Loading