Skip to content

Commit 0af2934

Browse files
sdks/python: mark milvus itests with require_docker_in_docker
1 parent 1fd8ce3 commit 0af2934

2 files changed

Lines changed: 30 additions & 33 deletions

File tree

sdks/python/apache_beam/ml/rag/enrichment/milvus_search_it_test.py

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@
3434

3535
import pytest
3636
import yaml
37-
from pymilvus import CollectionSchema
38-
from pymilvus import DataType
39-
from pymilvus import FieldSchema
40-
from pymilvus import Function
41-
from pymilvus import FunctionType
42-
from pymilvus import MilvusClient
43-
from pymilvus import RRFRanker
44-
from pymilvus.milvus_client import IndexParams
45-
from testcontainers.core.config import MAX_TRIES as TC_MAX_TRIES
46-
from testcontainers.core.config import testcontainers_config
47-
from testcontainers.core.generic import DbContainer
48-
from testcontainers.milvus import MilvusContainer
4937

5038
import apache_beam as beam
5139
from apache_beam.ml.rag.types import Chunk
@@ -54,7 +42,21 @@
5442
from apache_beam.testing.test_pipeline import TestPipeline
5543
from apache_beam.testing.util import assert_that
5644

45+
# pylint: disable=ungrouped-imports
5746
try:
47+
from pymilvus import (
48+
CollectionSchema,
49+
DataType,
50+
FieldSchema,
51+
Function,
52+
FunctionType,
53+
MilvusClient,
54+
RRFRanker)
55+
from pymilvus.milvus_client import IndexParams
56+
from testcontainers.core.config import MAX_TRIES as TC_MAX_TRIES
57+
from testcontainers.core.config import testcontainers_config
58+
from testcontainers.core.generic import DbContainer
59+
from testcontainers.milvus import MilvusContainer
5860
from apache_beam.transforms.enrichment import Enrichment
5961
from apache_beam.ml.rag.enrichment.milvus_search import (
6062
MilvusSearchEnrichmentHandler,
@@ -467,7 +469,7 @@ def create_user_yaml(service_port: int, max_vector_field_num=5):
467469
os.remove(path)
468470

469471

470-
@pytest.mark.uses_testcontainer
472+
@pytest.mark.require_docker_in_docker
471473
@unittest.skipUnless(
472474
platform.system() == "Linux",
473475
"Test runs only on Linux due to lack of support, as yet, for nested "
@@ -483,22 +485,16 @@ class TestMilvusSearchEnrichment(unittest.TestCase):
483485

484486
@classmethod
485487
def setUpClass(cls):
486-
try:
487-
cls._db = MilvusEnrichmentTestHelper.start_db_container(
488-
cls._version, vector_client_max_retries=1, tc_max_retries=1)
489-
cls._connection_params = MilvusConnectionParameters(
490-
uri=cls._db.uri,
491-
user=cls._db.user,
492-
password=cls._db.password,
493-
db_id=cls._db.id,
494-
token=cls._db.token)
495-
cls._collection_load_params = MilvusCollectionLoadParameters()
496-
cls._collection_name = MilvusEnrichmentTestHelper.initialize_db_with_data(
497-
cls._connection_params)
498-
except Exception as e:
499-
pytest.skip(
500-
f"Skipping all tests in {cls.__name__} due to DB startup failure: {e}"
501-
)
488+
cls._db = MilvusEnrichmentTestHelper.start_db_container(cls._version)
489+
cls._connection_params = MilvusConnectionParameters(
490+
uri=cls._db.uri,
491+
user=cls._db.user,
492+
password=cls._db.password,
493+
db_id=cls._db.id,
494+
token=cls._db.token)
495+
cls._collection_load_params = MilvusCollectionLoadParameters()
496+
cls._collection_name = MilvusEnrichmentTestHelper.initialize_db_with_data(
497+
cls._connection_params)
502498

503499
@classmethod
504500
def tearDownClass(cls):
@@ -1368,4 +1364,4 @@ def assert_chunks_equivalent(
13681364

13691365

13701366
if __name__ == '__main__':
1371-
unittest.main()
1367+
unittest.main()

sdks/python/setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ def get_portability_package_data():
401401
'typing-extensions>=3.7.0',
402402
'zstandard>=0.18.0,<1',
403403
'pyyaml>=3.12,<7.0.0',
404-
'pymilvus>=2.5.10,<3.0.0',
405404
# Dynamic dependencies must be specified in a separate list, otherwise
406405
# Dependabot won't be able to parse the main list. Any dynamic
407406
# dependencies will not receive updates from Dependabot.
@@ -445,7 +444,8 @@ def get_portability_package_data():
445444
'mysql-connector-python>=9.3.0',
446445
'python-tds>=1.16.1',
447446
'sqlalchemy-pytds>=1.0.2',
448-
'oracledb>=3.1.1'
447+
'oracledb>=3.1.1',
448+
'milvus'
449449
],
450450
'gcp': [
451451
'cachetools>=3.1.0,<6',
@@ -588,7 +588,8 @@ def get_portability_package_data():
588588
'transformers==4.25.1'
589589
],
590590
'xgboost': ['xgboost>=1.6.0,<2.1.3', 'datatable==1.0.0'],
591-
'tensorflow-hub': ['tensorflow-hub>=0.14.0,<0.16.0']
591+
'tensorflow-hub': ['tensorflow-hub>=0.14.0,<0.16.0'],
592+
'milvus': ['pymilvus>=2.5.10,<3.0.0']
592593
},
593594
zip_safe=False,
594595
# PyPI package information.

0 commit comments

Comments
 (0)