Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add SQLDocumentStore tests #3517

Merged
merged 6 commits into from
Nov 4, 2022
Merged

feat: add SQLDocumentStore tests #3517

merged 6 commits into from
Nov 4, 2022

Conversation

masci
Copy link
Contributor

@masci masci commented Nov 2, 2022

Related Issues

  • fixes n/a

Proposed Changes:

Run the DocumentStoreBaseTestAbstract with SQLDocumentStore

How did you test it?

Tests are running in the CI

Notes for the reviewer

The SQLDocumentStore is buggy and partially implemented in several parts, so a bunch of the base tests were failing. I have skipped the failing tests in this PR as filling the feature gap would require quite an implementation effort.

Checklist

@@ -141,8 +141,6 @@ jobs:
ES_JAVA_OPTS: "-Xms128m -Xmx256m"
ports:
- 9200:9200
# env:
# ELASTICSEARCH_HOST: "elasticsearch"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

leftover from previous PR

@@ -179,8 +205,6 @@ jobs:
ES_JAVA_OPTS: "-Xms128m -Xmx256m"
ports:
- 9200:9200
# env:
# OPENSEARCH_HOST: "opensearch"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

leftover from previous PR

@@ -142,27 +142,41 @@ def test_get_all_documents_with_incorrect_filter_value(self, ds, documents):
assert len(result) == 0

@pytest.mark.integration
def test_extended_filter(self, ds, documents):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function was too big in any case, it was ported as it was in the first step of the refactoring but breaking it down was functional to this PR as the docstore doesn't fully support metadata and some tests are expected not to pass

@@ -172,21 +172,6 @@ def test_get_all_documents_with_correct_filters(document_store_with_docs):
assert {d.meta["meta_field"] for d in documents} == {"test1", "test3"}


def test_get_all_documents_with_correct_filters_legacy_sqlite(docs, tmp_path):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was redundant at this point

@@ -410,47 +395,6 @@ def test_write_document_meta(document_store: BaseDocumentStore):
assert document_store.get_document_by_id("4").meta["meta_field"] == "test4"


@pytest.mark.parametrize("document_store", ["sql"], indirect=True)
def test_sql_write_document_invalid_meta(document_store: BaseDocumentStore):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these two tests were ported to the new class

@masci masci marked this pull request as ready for review November 2, 2022 17:09
@masci masci requested a review from a team as a code owner November 2, 2022 17:09
@masci masci requested review from bogdankostic and removed request for a team November 2, 2022 17:09
@masci masci changed the title add SQLDocumentStore tests feature: add SQLDocumentStore tests Nov 2, 2022
@masci masci changed the title feature: add SQLDocumentStore tests feat: add SQLDocumentStore tests Nov 2, 2022
Copy link
Contributor

@ZanSara ZanSara left a comment

Choose a reason for hiding this comment

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

A great step forward for SQLDocumentStore 🚀

A question: do you think we can afford, in the future, to run these tests on another SQL database, like PostgreSQL? I suppose subclassing this suite and giving another URL to the constructor should suffice, but I wonder if it's worth taking the time on the CI for this. It will also require a PostgreSQL container. Maybe worth a TODO?

.github/workflows/tests.yml Outdated Show resolved Hide resolved
.github/workflows/tests.yml Outdated Show resolved Hide resolved
haystack/document_stores/sql.py Outdated Show resolved Hide resolved
masci and others added 2 commits November 3, 2022 15:59
Co-authored-by: Sara Zan <sara.zanzottera@deepset.ai>
Copy link
Contributor

@bogdankostic bogdankostic left a comment

Choose a reason for hiding this comment

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

LGTM, cool how you split up the filtering tests! Just left a tiny comment with regard to the naming of two variables.

BTW, should we open an issue about the filtering not working for SQLDocumentStore?

test/document_stores/test_base.py Outdated Show resolved Hide resolved
Co-authored-by: bogdankostic <bogdankostic@web.de>
@masci masci merged commit 2bb8133 into main Nov 4, 2022
@masci masci deleted the massi/sql-test branch November 4, 2022 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants