Skip to content

[Fix] Router code coverage CI failure for health check filter tests - #24812

Merged
yuneng-berri merged 2 commits into
mainfrom
litellm_/objective-mendel
Mar 30, 2026
Merged

[Fix] Router code coverage CI failure for health check filter tests#24812
yuneng-berri merged 2 commits into
mainfrom
litellm_/objective-mendel

Conversation

@yuneng-berri

Copy link
Copy Markdown
Collaborator

Relevant issues

Router code coverage CI check failing with:

0.94% of functions in router.py are not tested: ['_async_filter_health_check_unhealthy_deployments', '_filter_health_check_unhealthy_deployments']

Summary

Failure Path (Before Fix)

router_code_coverage.py only scans test files with "router" in the filename. The test file test_health_check_routing.py didn't match this filter, so the two functions appeared untested despite having full test coverage.

Fix

Renamed test_health_check_routing.pytest_router_health_check_routing.py so the coverage scanner picks it up.

Testing

  • python3 ./tests/code_coverage_tests/router_code_coverage.py now reports untested_perc: 0.0
  • All 9 tests in the renamed file pass

Type

🐛 Bug Fix
✅ Test

The router_code_coverage.py script only scans test files with "router" in the filename.
test_health_check_routing.py was invisible to this check, causing _async_filter_health_check_unhealthy_deployments
and _filter_health_check_unhealthy_deployments to appear untested.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@vercel

vercel Bot commented Mar 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Mar 30, 2026 8:18pm

Request Review

@codspeed-hq

codspeed-hq Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing litellm_/objective-mendel (4f03273) with main (1757e1d)

Open in CodSpeed

@greptile-apps

greptile-apps Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a false-positive CI failure in the router code-coverage check by renaming test_health_check_routing.pytest_router_health_check_routing.py. The coverage scanner (router_code_coverage.py) only processes test files whose name contains the word "router" (line 45: if file.endswith(".py") and "router" in file.lower()), so the two functions _filter_health_check_unhealthy_deployments and _async_filter_health_check_unhealthy_deployments were incorrectly flagged as untested despite having full mock-based coverage. The rename is the minimal correct fix; no test logic was modified.

  • Root cause identified correctly: the scanner's filename filter is well understood and the fix directly addresses it.
  • Test content unchanged: 100% similarity index confirms no test weakening or regression masking.
  • All 9 tests use mock objects (FakeRouter, DualCache) — no real network calls, consistent with the test isolation policy.
  • Evidence of fix provided: PR description includes the expected untested_perc: 0.0 output and confirms all 9 tests pass after the rename.

Confidence Score: 5/5

  • Safe to merge — pure file rename with no logic changes.
  • The change is a single file rename with 100% content similarity. It correctly targets the root cause (the coverage scanner's filename filter), does not modify any test assertions, and provides evidence of resolution. No P0/P1 issues found.
  • No files require special attention.

Important Files Changed

Filename Overview
tests/test_litellm/router_utils/test_router_health_check_routing.py Renamed from test_health_check_routing.py; file content is 100% identical — adds "router" to filename so the coverage scanner (which filters on "router" in file.lower()) picks it up correctly.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["router_code_coverage.py\nscans test directories"] --> B{"'router' in\nfilename?"}
    B -- "No ❌\ntest_health_check_routing.py\n(before rename)" --> C["Skipped\n→ functions appear untested\n→ CI fails"]
    B -- "Yes ✅\ntest_router_health_check_routing.py\n(after rename)" --> D["File processed\n→ functions marked tested\n→ CI passes"]
Loading

Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

@yuneng-berri
yuneng-berri merged commit 4332a0b into main Mar 30, 2026
75 of 107 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_/objective-mendel branch March 30, 2026 21:11
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
[Fix] Router code coverage CI failure for health check filter tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants