test(agno-moss): add offline unit tests for runtime
AM
5d ago+344+344+012345678901234567890123456789-0-0-0123456789
Pull Request Checklist
Please ensure that your PR meets the following requirements:
- I have read the CONTRIBUTING guide.
- I have updated the documentation (if applicable).
- My code follows the style guidelines of this project.
- I have performed a self-review of my own code.
- I have added tests that prove my fix is effective or that my feature works.
- New and existing unit tests pass locally with my changes.
Description
Adds a complete, fast (<0.2s), and fully offline test suite for packages/agno-moss using pytest, pytest-asyncio, and an AsyncMock-backed MossClient.
Scope of Coverage:
- Round-trip document mapping: Verifies
_to_moss_doc()and_to_document()preserveid,text/content,metadata,content_hash, and score mapping. - Insert / Upsert: Tests index auto-creation when missing,
add_docsdelegation withupsert=Truewhen present, and empty list no-op. - Search: Tests
searchandasync_searchoption forwarding (top_k,alpha, filters) and result mapping to agnoDocumentobjects. - Existence checks:
exists(),async_exists(),name_exists(),id_exists(), andcontent_hash_exists(). - Lifecycle & Deletions:
create(),drop(),delete(),delete_by_id(), and no-op / unsupported deletion fallbacks. - Sync execution wrapper: Confirms
_run()works seamlessly both outside and inside an activeasyncioevent loop.
Partially addresses #521 (agno-moss component).
Type of Change
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- This change requires a documentation update
Summary by CodeRabbit
- Tests
- Added coverage for runtime initialization, synchronous and asynchronous operations, document handling, search, and index lifecycle behavior.
- Added checks for missing credentials, empty upserts, unloaded-index content checks, and unsupported deletion methods.