-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Document Store test refactoring #3449
Conversation
ae4456b
to
e042a88
Compare
"pinecone", | ||
"opensearch", | ||
} | ||
all_doc_stores = {"elasticsearch", "faiss", "sql", "memory", "milvus1", "milvus", "weaviate", "pinecone"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So as we add test_memory.py, it will get removed from these existing "references"? We'll do that one-by-one for each document store @masci ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vblagoje correct, up to the point where we can remove test_document_store.py
@@ -110,14 +115,94 @@ jobs: | |||
run: pip install .[all] | |||
|
|||
- name: Run | |||
run: pytest -m "unit" test/ | |||
run: pytest -m "unit" test/${{ matrix.topic }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, this needs to match the test directory, we add a small comment perhaps?
port=9201, | ||
knn_engine="nmslib", | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have test_opensearch.py
, and we are removing OpenSearchDocumentStore from get_document_store
yet we don't do the same for ElasticsearchDocumentStore
. We are not removing it from get_document_store
and we added 'test_elasticsearch.py'. Just a bit confused here. What's happening?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elasticsearch keeps being used in some tests in test_document_store.py
that are triggered with the complex markers matrix, while Opensearch had a way smaller test coverage there. The result is that Opensearch tests are now 100% implemented in the new module test_opensearch.py
while Elasticsearch needs more iterations to finish moving tests out of test_document_store.py
into test_elasticsearch.py
. This can't be done without touching the other Document Stores so I plan to do that later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it looks gtg. Somewhat complex refactoring, but I see its intention, and it seems like a very good one!
Related Issues
Proposed Changes
Refactor the tests into a class hierarchy that reflects the Document Store classes.
Why?
How
DocumentStoreBaseTestAbstract
class contains the tests for the abstract methods inBaseDocumentStore
. These tests receive an instance of a document store in form of theds
fixture.DocumentStoreBaseTestAbstract
are responsible for defining theds
fixture, returning the specific instance of the Document Store they intend to testDocumentStoreBaseTestAbstract
for each subclass, hence exercising a different Document Store at each roundNotes for the reviewer
SearchEngineDocumentStore
hierarchy, the other will follow in separate PRspytest.mark.elasticsearch
were moved in the new hierarchytest_document_store.py
was left there, waiting for the other Document Stores to be portedChecklist