Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Jan 6, 2026

Description

LCORE-1071: docstrings in config models

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Tools used to create PR

  • Assisted-by: CodeRabbitAI
  • Generated by: N/A

Related Tickets & Documents

  • Related Issue #LCORE-1071

Summary by CodeRabbit

  • Tests
    • Enhanced test documentation with expanded docstrings and clarified assertion expectations for better test clarity and maintainability.

Note: No functional changes or end-user visible impacts in this release.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Walkthrough

The 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

Cohort / File(s) Summary
CORS Configuration Tests
tests/unit/models/config/test_cors.py
Expanded test docstrings with detailed behavior descriptions; added explicit assertion expectations for default values (origins, credentials, methods, headers); enhanced ValueError message expectations with guidance about explicit origins or disabling credentials.
Configuration Model Tests
tests/unit/models/config/test_customization.py, test_database_configuration.py, test_postgresql_database_configuration.py, test_quota_limiter_config.py
Docstring enhancements across four test files describing test intent, parameters, and expected error conditions; no changes to test logic, assertions, or control flow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • #845: Modifies tests in test_cors.py, adjusting expected ValueError message/strings for CORS validation
  • #956: Non-functional docstring-only updates across config-related unit tests with expanded/clarified descriptions
  • #877: Changes CORSConfiguration's post-validation error wording that directly corresponds to the tightened test assertions in this PR's CORS test updates

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'LCORE-1071: docstrings in config models' accurately reflects the main change in the PR, which updates docstrings across multiple configuration model test files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between ee88333 and eebfe9c.

📒 Files selected for processing (5)
  • tests/unit/models/config/test_cors.py
  • tests/unit/models/config/test_customization.py
  • tests/unit/models/config/test_database_configuration.py
  • tests/unit/models/config/test_postgresql_database_configuration.py
  • tests/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.py
  • tests/unit/models/config/test_postgresql_database_configuration.py
  • tests/unit/models/config/test_customization.py
  • tests/unit/models/config/test_cors.py
  • tests/unit/models/config/test_database_configuration.py
tests/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

Use pytest-mock with AsyncMock objects for mocking in tests

Files:

  • tests/unit/models/config/test_quota_limiter_config.py
  • tests/unit/models/config/test_postgresql_database_configuration.py
  • tests/unit/models/config/test_customization.py
  • tests/unit/models/config/test_cors.py
  • tests/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 subtests fixture 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_path validation 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.

@tisnik tisnik merged commit b24cdaf into lightspeed-core:main Jan 6, 2026
19 of 27 checks passed
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.

1 participant