test(config): add comprehensive tests for router config utilities #3349
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds 26 new tests to
router/src/config.rs, improving test coverage for the router's configuration handling. This is a lightweight maintenance contribution aligned with TGI's maintenance mode guidelines.Changes
Tests Added
Utility Function Tests (14 tests)
test_gcd_basic_casestest_gcd_edge_casestest_get_factors_basictest_get_factors_primetest_get_factors_perfect_squaretest_get_factors_onetest_select_best_resolution_*test_find_supported_resolutions_*test_get_best_fit_*Model Configuration Tests (7 tests)
test_idefics2_constant_featurestest_idefics3_constantstest_paligemma_features_from_configtest_qwen2vl_features_calculationtest_qwen2_5vl_features_calculationtest_llama4_accessorstest_llama4_aspect_ratiosConfig Enum Serialization Tests (5 tests)
test_config_deserialize_simple_variantstest_config_deserialize_idefics2test_config_deserialize_idefics3test_config_deserialize_qwen2vltest_config_deserialize_deepseek_variantsMotivation
The
config.rsfile contains critical utility functions for:These functions previously had minimal test coverage (only 1 test for
LlavaNext). This PR ensures correctness of these core utilities without modifying any production behavior.Test Plan
cargo test -p text-generation-router configto verify all tests pass🤖 Generated with Claude Code