Skip to content

refactor(opensearch): use async DocumentStore mixin tests#3224

Merged
davidsbatista merged 7 commits intodeepset-ai:mainfrom
Aftabbs:refactor/opensearch-async-mixin-tests
Apr 28, 2026
Merged

refactor(opensearch): use async DocumentStore mixin tests#3224
davidsbatista merged 7 commits intodeepset-ai:mainfrom
Aftabbs:refactor/opensearch-async-mixin-tests

Conversation

@Aftabbs
Copy link
Copy Markdown
Contributor

@Aftabbs Aftabbs commented Apr 24, 2026

Related Issues

Proposed Changes:

Replaces 13 duplicated async test methods in TestDocumentStoreAsync with the generic mixin classes from haystack.testing.document_store_async (available since haystack-ai 2.28.0).

Mixins added:

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

Preserved (OpenSearch-specific): All bm25, embedding, routing, metadata search, SQL, and nested-fields tests remain unchanged — these exercise OpenSearch-specific behaviour not covered by the generic mixins.

Version bump: haystack-ai>=2.26.1>=2.28.0 (required for haystack.testing.document_store_async module).

How did you test it?

  • Integration tests run against a live OpenSearch instance via CI (pytest -v -m integration)
  • Mixin-inherited tests verified to appear in the test run
  • No regression on OpenSearch-specific bm25/embedding/sql tests

Notes for the reviewer

The mixin classes standardise async document store test coverage across integrations. OpenSearch-specific tests (routing, BM25, embedding, SQL, nested fields) are preserved unchanged.

Checklist

Replace duplicated async test methods in TestDocumentStoreAsync with the
generic mixin classes from haystack.testing.document_store_async (added
in haystack-ai 2.28.0). This eliminates 13 tests that are now provided by:

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

OpenSearch-specific tests (bm25, embedding, routing, metadata_search, sql,
nested fields) are preserved unchanged.

Bumps minimum haystack-ai version to >=2.28.0 for document_store_async
module availability.

Closes deepset-ai#3049
@Aftabbs Aftabbs requested a review from a team as a code owner April 24, 2026 09:06
@Aftabbs Aftabbs requested review from davidsbatista and removed request for a team April 24, 2026 09:06
@davidsbatista
Copy link
Copy Markdown
Contributor

@Aftabbs thanks for the contribution!

Please use the default template to comment on the PR.

…in haystack v2.28.0

In haystack v2.28.0, CountDocumentsAsyncTest.test_count_not_empty_async
is missing the @staticmethod decorator (all other mixin methods have it).
Without @staticmethod, pytest binds `document_store` to self (the test
instance) instead of injecting it as a fixture, causing an AttributeError.
Override the method locally with a correct instance-method signature until
haystack ships the fix in a new release.
@github-actions github-actions Bot added the type:documentation Improvements or additions to documentation label Apr 25, 2026
@davidsbatista
Copy link
Copy Markdown
Contributor

The tests are still failing, can you have a look?

@github-actions
Copy link
Copy Markdown
Contributor

Coverage report (opensearch)

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

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.

I fixed the failing tests and did a few adjustments.

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

Labels

integration:opensearch 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 OpenSearch

2 participants