Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Oct 7, 2025

Description

LCORE-786: fixed issues in unit tests

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

Related Tickets & Documents

  • Related Issue #LCORE-786

Summary by CodeRabbit

  • Tests
    • Strengthened configuration tests by verifying an API key is present during initialization.
    • Standardized path handling in tests by using string paths, improving cross-platform consistency.
    • Overall test updates enhance reliability and reduce type-related flakiness.
  • Notes
    • No user-facing changes or API modifications; this update only affects test coverage and stability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Tests in tests/unit/test_configuration.py were updated to assert api_key presence during dict-based initialization and to pass string paths to load_configuration by converting Path objects with str().

Changes

Cohort / File(s) Change Summary
Tests — configuration loading
tests/unit/test_configuration.py
Added assertion that llama_stack_configuration.api_key is not None in dict-init test; replaced load_configuration(Path) calls with load_configuration(str(Path)) across tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A twitch of whiskers, a tap of a key,
I nibbled the paths from Path to string-y.
API carrots? Counted—none missing!
Config burrow warm and hissing.
Hop-hop tests pass, ears held high,
Tiny tweaks beneath the sky. 🐇✨

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 succinctly indicates a bug fix in the unit tests, which aligns with the changes made to add assertions and adjust argument types, making it clear and relevant to the primary change.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d977a2b and f8bd9d1.

📒 Files selected for processing (1)
  • tests/unit/test_configuration.py (7 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.py: All modules start with descriptive module-level docstrings explaining purpose
Use logger = logging.getLogger(name) for module logging after import logging
Define type aliases at module level for clarity
All functions require docstrings with brief descriptions
Provide complete type annotations for all function parameters and return types
Use typing_extensions.Self in model validators where appropriate
Use modern union syntax (str | int) and Optional[T] or T | None consistently
Function names use snake_case with descriptive, action-oriented prefixes (get_, validate_, check_)
Avoid in-place parameter modification; return new data structures instead of mutating arguments
Use appropriate logging levels: debug, info, warning, error with clear messages
All classes require descriptive docstrings explaining purpose
Class names use PascalCase with conventional suffixes (Configuration, Error/Exception, Resolver, Interface)
Abstract base classes should use abc.ABC and @AbstractMethod for interfaces
Provide complete type annotations for all class attributes
Follow Google Python docstring style for modules, classes, and functions, including Args, Returns, Raises, Attributes sections as needed

Files:

  • tests/unit/test_configuration.py
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 in tests; pytest is the standard

Files:

  • tests/unit/test_configuration.py
tests/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

tests/**/*.py: Use pytest-mock to create AsyncMock objects for async interactions in tests
Use the shared auth mock constant: MOCK_AUTH = ("mock_user_id", "mock_username", False, "mock_token") in tests

Files:

  • tests/unit/test_configuration.py
🧬 Code graph analysis (1)
tests/unit/test_configuration.py (1)
src/configuration.py (2)
  • llama_stack_configuration (79-83)
  • load_configuration (52-58)
⏰ 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). (2)
  • GitHub Check: build-pr
  • GitHub Check: e2e_tests (ci)
🔇 Additional comments (2)
tests/unit/test_configuration.py (2)

126-126: LGTM!

The assertion explicitly documents that api_key should be present after dictionary initialization. While line 127 would fail anyway if api_key were None, this assertion provides a clearer test intent and better error message.


258-258: All load_configuration calls now receive strings; no further changes required.

The remaining calls (args.config_file, config_path, and configuration_filename) are already str.


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.

@tisnik tisnik merged commit 511d289 into lightspeed-core:main Oct 7, 2025
18 of 19 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