Skip to content

Commit

Permalink
Merge pull request #23 from zc277584121/main
Browse files Browse the repository at this point in the history
adapt test with milvus lite and release
  • Loading branch information
jaelgu authored Jun 11, 2024
2 parents f0b8520 + 31b5223 commit 59d59b8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/milvus_haystack/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023-present Tuana Celik <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
__version__ = "0.0.7"
__version__ = "0.0.8"
17 changes: 8 additions & 9 deletions tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@

logger = logging.getLogger(__name__)

DEFAULT_CONNECTION_ARGS = {
"uri": "http://localhost:19530",
# "uri": "./milvus_test.db", # This uri works for Milvus Lite
}


class TestDocumentStore(CountDocumentsTest, WriteDocumentsTest, DeleteDocumentsTest):
@pytest.fixture
def document_store(self) -> MilvusDocumentStore:
return MilvusDocumentStore(
connection_args={
"host": "localhost",
"port": "19530",
"user": "",
"password": "",
"secure": False,
},
connection_args=DEFAULT_CONNECTION_ARGS,
drop_old=True,
)

Expand Down Expand Up @@ -61,7 +60,7 @@ def test_to_and_from_dict(self, document_store: MilvusDocumentStore):
"collection_name": "HaystackCollection",
"collection_description": "",
"collection_properties": None,
"connection_args": {"host": "localhost", "port": "19530", "user": "", "password": "", "secure": False},
"connection_args": DEFAULT_CONNECTION_ARGS,
"consistency_level": "Session",
"index_params": None,
"search_params": None,
Expand All @@ -78,6 +77,6 @@ def test_to_and_from_dict(self, document_store: MilvusDocumentStore):
assert document_store_dict == expected_dict
reconstructed_document_store = MilvusDocumentStore.from_dict(document_store_dict)
for field in vars(reconstructed_document_store):
if field.startswith("__"):
if field.startswith("__") or field == "alias":
continue
assert getattr(reconstructed_document_store, field) == getattr(document_store, field)
25 changes: 9 additions & 16 deletions tests/test_embedding_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@

logger = logging.getLogger(__name__)

DEFAULT_CONNECTION_ARGS = {
"uri": "http://localhost:19530",
# "uri": "./milvus_test.db", # This uri works for Milvus Lite
}


class TestMilvusEmbeddingTests:
@pytest.fixture
def document_store(self) -> MilvusDocumentStore:
return MilvusDocumentStore(
connection_args={
"host": "localhost",
"port": "19530",
"user": "",
"password": "",
"secure": False,
},
connection_args=DEFAULT_CONNECTION_ARGS,
drop_old=True,
)

Expand Down Expand Up @@ -52,7 +51,7 @@ def test_to_dict(self, document_store: MilvusDocumentStore):
"collection_name": "HaystackCollection",
"collection_description": "",
"collection_properties": None,
"connection_args": {"host": "localhost", "port": "19530", "user": "", "password": "", "secure": False},
"connection_args": DEFAULT_CONNECTION_ARGS,
"consistency_level": "Session",
"index_params": None,
"search_params": None,
Expand Down Expand Up @@ -82,13 +81,7 @@ def test_from_dict(self, document_store: MilvusDocumentStore):
"collection_name": "HaystackCollection",
"collection_description": "",
"collection_properties": None,
"connection_args": {
"host": "localhost",
"port": "19530",
"user": "",
"password": "",
"secure": False,
},
"connection_args": DEFAULT_CONNECTION_ARGS,
"consistency_level": "Session",
"index_params": None,
"search_params": None,
Expand All @@ -115,7 +108,7 @@ def test_from_dict(self, document_store: MilvusDocumentStore):
continue
elif field == "document_store":
for doc_store_field in vars(document_store):
if doc_store_field.startswith("__"):
if doc_store_field.startswith("__") or doc_store_field == "alias":
continue
assert getattr(reconstructed_retriever.document_store, doc_store_field) == getattr(
document_store, doc_store_field
Expand Down

0 comments on commit 59d59b8

Please sign in to comment.