-
Notifications
You must be signed in to change notification settings - Fork 64
LCORE-1071: docstrings in config models #962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LCORE-1071: docstrings in config models #962
Conversation
…se_configuration.py
WalkthroughThe PR updates docstrings across multiple test files in the config module, expanding test descriptions and clarifying expected error messages. No functional code changes or production code modifications are included. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/unit/models/config/test_cors.py (1)
82-95: Missing space in CORS error message.The error message in
CORSConfiguration.check_cors_configuration()(src/models/config.py, lines 150-151) is missing a space between the period and "Use":"wildcard."directly concatenates with"Use explicit"producing"wildcard.Use explicit". Add a space before "Use" in line 151.
🧹 Nitpick comments (4)
tests/unit/models/config/test_quota_limiter_config.py (3)
26-31: Docstring opening line is misleading.The docstring starts with "Test the default configuration" but this test validates error handling for invalid input, not the default configuration. Consider updating to something like "Test that negative initial_quota raises ValueError."
🔎 Suggested fix
def test_quota_limiter_configuration_improper_value_1() -> None: - """Test the default configuration. + """Test that negative initial_quota raises ValueError. Verify that constructing a QuotaLimiterConfiguration with a negative `initial_quota` raises a ValueError with message "Input should be greater than or equal to 0". """
43-50: Same issue: misleading opening line.This docstring also opens with "Test the default configuration" but tests error handling for negative
quota_increase.🔎 Suggested fix
def test_quota_limiter_configuration_improper_value_2() -> None: - """Test the default configuration. + """Test that negative quota_increase raises ValueError. Verify that providing a negative `quota_increase` raises a ValueError.
62-69: Same issue: misleading opening line.Additionally, the "Raises" section is unconventional for test docstrings since test functions don't raise exceptions—they verify that the code under test raises them.
🔎 Suggested fix
def test_quota_limiter_configuration_improper_value_3() -> None: - """Test the default configuration. - - Check that constructing QuotaLimiterConfiguration with an invalid `type` - raises a ValueError with the expected message. - - Raises: - ValueError: if `type` is not 'user_limiter' or 'cluster_limiter'. - """ + """Test that invalid type raises ValueError. + + Check that constructing QuotaLimiterConfiguration with an invalid `type` + raises a ValueError with the expected message when `type` is not + 'user_limiter' or 'cluster_limiter'. + """tests/unit/models/config/test_database_configuration.py (1)
68-79: Minor: "Raises" section is unconventional for test docstrings.The docstring is otherwise accurate. However, the "Raises" section implies this function raises
ValidationError, when in fact it verifies that the code under test raises it. Consider removing or rephrasing this section.🔎 Suggested fix
def test_two_databases_configuration() -> None: """Test if two databases configuration is checked. Verify that constructing DatabaseConfiguration with both PostgreSQL and SQLite configurations raises a validation error. Asserts that passing both `postgres` and `sqlite` to DatabaseConfiguration triggers a `ValidationError` with message "Only one database configuration can be provided". - - Raises: - ValidationError: If more than one database configuration is provided. """
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
tests/unit/models/config/test_cors.pytests/unit/models/config/test_customization.pytests/unit/models/config/test_database_configuration.pytests/unit/models/config/test_postgresql_database_configuration.pytests/unit/models/config/test_quota_limiter_config.py
🧰 Additional context used
📓 Path-based instructions (2)
tests/{unit,integration}/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
tests/{unit,integration}/**/*.py: Use pytest for all unit and integration tests; do not use unittest framework
Unit tests must achieve 60% code coverage; integration tests must achieve 10% coverage
Files:
tests/unit/models/config/test_quota_limiter_config.pytests/unit/models/config/test_postgresql_database_configuration.pytests/unit/models/config/test_customization.pytests/unit/models/config/test_cors.pytests/unit/models/config/test_database_configuration.py
tests/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Use
pytest-mockwith AsyncMock objects for mocking in tests
Files:
tests/unit/models/config/test_quota_limiter_config.pytests/unit/models/config/test_postgresql_database_configuration.pytests/unit/models/config/test_customization.pytests/unit/models/config/test_cors.pytests/unit/models/config/test_database_configuration.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: build-pr
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
- GitHub Check: E2E: library mode / ci
- GitHub Check: E2E: server mode / vertexai
- GitHub Check: E2E: server mode / ci
- GitHub Check: E2E: server mode / azure
- GitHub Check: E2E: library mode / vertexai
- GitHub Check: E2E: library mode / azure
🔇 Additional comments (5)
tests/unit/models/config/test_customization.py (1)
12-29: LGTM!The expanded docstring accurately documents the three subtests and their purposes. The parameter documentation for the
subtestsfixture is helpful for understanding the test structure.tests/unit/models/config/test_postgresql_database_configuration.py (2)
53-61: LGTM!The expanded docstring accurately documents the three port validation scenarios. The specific error messages mentioned match the assertions in the code.
83-94: LGTM!The docstring clearly describes the two
ca_cert_pathvalidation scenarios and includes helpful parameter documentation.tests/unit/models/config/test_cors.py (2)
9-19: LGTM!The expanded docstring clearly documents the expected default values for
CORSConfiguration, improving test readability.
59-67: LGTM!The docstring accurately describes the test scenario for wildcard origin with credentials disabled.
Description
LCORE-1071: docstrings in config models
Type of change
Tools used to create PR
Related Tickets & Documents
Summary by CodeRabbit
Note: No functional changes or end-user visible impacts in this release.
✏️ Tip: You can customize this high-level summary in your review settings.