Skip to content

fix(test): update test_add_and_delete_deployments for new Router behavior#20649

Open
shin-bot-litellm wants to merge 1 commit intomainfrom
litellm_fix_test_add_delete_deployments
Open

fix(test): update test_add_and_delete_deployments for new Router behavior#20649
shin-bot-litellm wants to merge 1 commit intomainfrom
litellm_fix_test_add_delete_deployments

Conversation

@shin-bot-litellm
Copy link
Collaborator

Summary

Fixes failing test test_add_and_delete_deployments[0-None]

Root Cause

The _update_llm_router function was updated to always create a Router even with an empty model list (to support search_tools). See comment in code:

# Create router even with empty model list to support search_tools
# Router can function with model_list=[] and only search_tools

The test expectation was outdated - it expected the router to remain None when starting with None and an empty model list.

Fix

Update the test to verify:

  • Router is created (not None)
  • Router's model_list is empty (length 0)

Instead of expecting router to be None.

Testing

  • CI will validate

…vior

Router is now created even with empty model_list to support search_tools.
Update test to verify router exists with empty model_list instead of
expecting router to be None.
@vercel
Copy link

vercel bot commented Feb 7, 2026

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

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 7, 2026 5:34pm

Request Review

@CLAassistant
Copy link

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.


Shin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 7, 2026

Greptile Overview

Greptile Summary

Updates test assertions to align with Router behavior change introduced in commit ac5c5ee. The _update_llm_router function now creates a Router instance even with an empty model list to support search_tools-only use cases. Previously, the test expected llm_router to remain None when initialized with None and an empty model list. The fix correctly validates that:

  • A Router instance is created (not None)
  • The Router's model_list is empty (length 0)

This change is a straightforward test update that matches the production code behavior.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a straightforward test update that fixes outdated assertions to match current Router behavior. The new assertions correctly validate Router creation with an empty model_list, which aligns with the intentional behavior change in commit ac5c5ee to support search_tools-only routers. No production code is modified, and the test change is well-documented with inline comments.
  • No files require special attention

Important Files Changed

Filename Overview
tests/local_testing/test_config.py Updated test assertions to match new Router behavior where Router is created even with empty model list (for search_tools support)

Sequence Diagram

sequenceDiagram
    participant Test as test_add_and_delete_deployments
    participant ProxyConfig as ProxyConfig
    participant ProxyServer as litellm.proxy.proxy_server
    participant Router as litellm.Router
    
    Note over Test: Start with llm_router=None<br/>model_list_flag_value=0 (empty list)
    
    Test->>ProxyServer: setattr(llm_router, None)
    Test->>ProxyConfig: _update_llm_router(new_models=[])
    
    ProxyConfig->>ProxyConfig: get_config()
    ProxyConfig->>ProxyConfig: parse_search_tools()
    
    alt llm_router is None
        Note over ProxyConfig: New behavior: Create Router<br/>even with empty model_list
        ProxyConfig->>Router: Router(model_list=[], search_tools=...)
        Router-->>ProxyConfig: Router instance
        ProxyConfig->>ProxyServer: llm_router = Router instance
    end
    
    Test->>ProxyServer: llm_router = getattr(llm_router)
    Test->>Test: assert llm_router is not None ✓
    Test->>Test: assert len(llm_router.model_list) == 0 ✓
    
    Note over Test: Old behavior expected:<br/>llm_router == None<br/><br/>New behavior validates:<br/>Router created with empty model_list
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

2 participants