mirror of https://github.com/milvus-io/milvus.git
[cherry-pick][test] fix get collection (#23101)
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>pull/23118/head
parent
47e28fbe08
commit
1a545cb97a
|
@ -4,9 +4,7 @@ from collections import defaultdict
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from base.client_base import TestcaseBase
|
from base.client_base import TestcaseBase
|
||||||
from common import common_func as cf
|
from deploy.common import get_chaos_test_collections
|
||||||
from common import common_type as ct
|
|
||||||
from deploy.common import get_collections
|
|
||||||
from common.common_type import CaseLabel
|
from common.common_type import CaseLabel
|
||||||
from utils.util_log import test_log as log
|
from utils.util_log import test_log as log
|
||||||
|
|
||||||
|
@ -36,8 +34,8 @@ class TestGetCollections(TestcaseBase):
|
||||||
data = {
|
data = {
|
||||||
"all": selected_collections,
|
"all": selected_collections,
|
||||||
}
|
}
|
||||||
with open("/tmp/ci_logs/all_collections.json", "w") as f:
|
with open("/tmp/ci_logs/chaos_test_all_collections.json", "w") as f:
|
||||||
f.write(json.dumps(data))
|
f.write(json.dumps(data))
|
||||||
log.info(f"write {len(selected_collections)} collections to /tmp/ci_logs/all_collections.json")
|
log.info(f"write {len(selected_collections)} collections to /tmp/ci_logs/chaos_test_all_collections.json")
|
||||||
collections_in_json = get_collections()
|
collections_in_json = get_chaos_test_collections()
|
||||||
assert len(selected_collections) == len(collections_in_json)
|
assert len(selected_collections) == len(collections_in_json)
|
||||||
|
|
|
@ -44,9 +44,19 @@ def gen_search_param(index_type, metric_type="L2"):
|
||||||
return search_params
|
return search_params
|
||||||
|
|
||||||
|
|
||||||
def get_collections():
|
def get_deploy_test_collections():
|
||||||
try:
|
try:
|
||||||
with open("/tmp/ci_logs/all_collections.json", "r") as f:
|
with open("/tmp/ci_logs/deploy_test_all_collections.json", "r") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
collections = data["all"]
|
||||||
|
except Exception as e:
|
||||||
|
log.error(f"get_all_collections error: {e}")
|
||||||
|
return []
|
||||||
|
return collections
|
||||||
|
|
||||||
|
def get_chaos_test_collections():
|
||||||
|
try:
|
||||||
|
with open("/tmp/ci_logs/chaos_test_all_collections.json", "r") as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
collections = data["all"]
|
collections = data["all"]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -8,7 +8,7 @@ from common.common_type import CaseLabel, CheckTasks
|
||||||
from common.milvus_sys import MilvusSys
|
from common.milvus_sys import MilvusSys
|
||||||
from utils.util_pymilvus import *
|
from utils.util_pymilvus import *
|
||||||
from deploy.base import TestDeployBase
|
from deploy.base import TestDeployBase
|
||||||
from deploy.common import gen_index_param, gen_search_param, get_collections
|
from deploy.common import gen_index_param, gen_search_param, get_deploy_test_collections
|
||||||
from utils.util_log import test_log as log
|
from utils.util_log import test_log as log
|
||||||
|
|
||||||
default_nb = ct.default_nb
|
default_nb = ct.default_nb
|
||||||
|
@ -31,7 +31,7 @@ pymilvus_version = pymilvus.__version__
|
||||||
class TestActionSecondDeployment(TestDeployBase):
|
class TestActionSecondDeployment(TestDeployBase):
|
||||||
""" Test case of action before reinstall """
|
""" Test case of action before reinstall """
|
||||||
|
|
||||||
@pytest.fixture(scope="function", params=get_collections())
|
@pytest.fixture(scope="function", params=get_deploy_test_collections())
|
||||||
def all_collection_name(self, request):
|
def all_collection_name(self, request):
|
||||||
if request.param == [] or request.param == "":
|
if request.param == [] or request.param == "":
|
||||||
pytest.skip("The collection name is invalid")
|
pytest.skip("The collection name is invalid")
|
||||||
|
|
|
@ -2,7 +2,7 @@ import json
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from base.client_base import TestcaseBase
|
from base.client_base import TestcaseBase
|
||||||
from deploy.common import get_collections
|
from deploy.common import get_deploy_test_collections
|
||||||
from common.common_type import CaseLabel
|
from common.common_type import CaseLabel
|
||||||
from utils.util_log import test_log as log
|
from utils.util_log import test_log as log
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@ class TestGetCollections(TestcaseBase):
|
||||||
data = {
|
data = {
|
||||||
"all": all_collections,
|
"all": all_collections,
|
||||||
}
|
}
|
||||||
with open("/tmp/ci_logs/all_collections.json", "w") as f:
|
with open("/tmp/ci_logs/deploy_test_all_collections.json", "w") as f:
|
||||||
f.write(json.dumps(data))
|
f.write(json.dumps(data))
|
||||||
log.info(f"write {len(all_collections)} collections to /tmp/ci_logs/all_collections.json")
|
log.info(f"write {len(all_collections)} collections to /tmp/ci_logs/deploy_test_all_collections.json")
|
||||||
collections_in_json = get_collections()
|
collections_in_json = get_deploy_test_collections()
|
||||||
assert len(all_collections) == len(collections_in_json)
|
assert len(all_collections) == len(collections_in_json)
|
||||||
|
|
Loading…
Reference in New Issue