Skip to content

feat(mongodb-atlas): use async DocumentStore mixin tests#3249

Merged
davidsbatista merged 4 commits intodeepset-ai:mainfrom
SyedShahmeerAli12:feat/mongodb-atlas-async-mixin-tests
Apr 28, 2026
Merged

feat(mongodb-atlas): use async DocumentStore mixin tests#3249
davidsbatista merged 4 commits intodeepset-ai:mainfrom
SyedShahmeerAli12:feat/mongodb-atlas-async-mixin-tests

Conversation

@SyedShahmeerAli12
Copy link
Copy Markdown
Contributor

@SyedShahmeerAli12 SyedShahmeerAli12 commented Apr 28, 2026

Related Issues

Proposed Changes

Updates integrations/mongodb_atlas/tests/test_document_store_async.py to inherit the async mixin test classes from haystack.testing.document_store_async, removing duplicate test code that is now covered by the shared mixins.

Mixin classes added:

  • CountDocumentsAsyncTest
  • WriteDocumentsAsyncTest
  • DeleteDocumentsAsyncTest
  • DeleteAllAsyncTest
  • DeleteByFilterAsyncTest
  • FilterDocumentsAsyncTest
  • UpdateByFilterAsyncTest
  • CountDocumentsByFilterAsyncTest
  • CountUniqueMetadataByFilterAsyncTest
  • GetMetadataFieldsInfoAsyncTest
  • GetMetadataFieldMinMaxAsyncTest
  • GetMetadataFieldUniqueValuesAsyncTest

Tests removed (now covered by mixins):

  • test_write_documents_async
  • test_count_documents_async
  • test_filter_documents_async
  • test_delete_documents_async
  • test_delete_by_filter_async
  • test_update_by_filter_async
  • test_delete_all_documents_async
  • test_delete_all_documents_async_empty_collection
  • test_count_documents_by_filter_async
  • test_count_unique_metadata_by_filter_async
  • test_get_metadata_fields_info_async
  • test_get_metadata_field_min_max_async
  • test_get_metadata_field_unique_values_async

Tests kept (MongoDB Atlas-specific):

  • test_write_blob_async — binary/ByteStream document handling
  • test_delete_all_documents_async_with_recreate_collection — MongoDB-specific recreate_collection=True parameter

Overrides added:

  • test_count_not_empty_async base class uses @staticmethod which breaks fixture injection
  • test_write_documents_async MongoDB raises DuplicateDocumentError on duplicate with FAIL policy

How did you test it?

Unit tests (TestEnsureConnectionSetupAsync, TestMongoDBDocumentStoreAsyncUnit) run without requiring a live MongoDB connection. Integration tests require MONGO_CONNECTION_STRING.

Notes for the reviewer

Followed the same pattern as the Elasticsearch async test refactor. The @pytest_asyncio.fixture decorator is used for the document_store fixture, consistent with other integrations.

Checklist

@SyedShahmeerAli12 SyedShahmeerAli12 requested a review from a team as a code owner April 28, 2026 10:53
@SyedShahmeerAli12 SyedShahmeerAli12 requested review from sjrl and removed request for a team April 28, 2026 10:53
@github-actions
Copy link
Copy Markdown
Contributor

Heads-up for maintainers

This PR is from a fork and touches integrations whose integration tests require API keys.
Those tests are skipped in CI because fork PRs don't have access to repo secrets for security reasons.

Affected integrations:

  • mongodb_atlas

Please run the integration tests locally (hatch run test:integration inside each folder) before approving.

@github-actions github-actions Bot added the type:documentation Improvements or additions to documentation label Apr 28, 2026
@sjrl sjrl requested review from davidsbatista and removed request for sjrl April 28, 2026 11:03
@github-actions
Copy link
Copy Markdown
Contributor

Coverage report (mongodb_atlas)

This PR does not seem to contain any modification to coverable code.

@SyedShahmeerAli12
Copy link
Copy Markdown
Contributor Author

SyedShahmeerAli12 commented Apr 28, 2026

Hey @davidsbatista this PR is ready for review. Unit tests are passing in CI; integration tests require MONGO_CONNECTION_STRING which isn't available in fork PRs. Could you run them locally when you get a chance?

Copy link
Copy Markdown
Contributor

@davidsbatista davidsbatista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

@davidsbatista davidsbatista merged commit a25e538 into deepset-ai:main Apr 28, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:mongodb-atlas type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use async DocumentStore mixin tests in MongoDB Atlas

2 participants