[test] fix get collection (#23099)

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
This commit is contained in:
zhuwenxing 2023-03-29 15:22:01 +08:00 committed by GitHub
parent 3febb5e45a
commit a1d3030867
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 12 deletions

View File

@ -4,9 +4,7 @@ from collections import defaultdict
import pytest
from base.client_base import TestcaseBase
from common import common_func as cf
from common import common_type as ct
from deploy.common import get_collections
from deploy.common import get_chaos_test_collections
from common.common_type import CaseLabel
from utils.util_log import test_log as log
@ -36,8 +34,8 @@ class TestGetCollections(TestcaseBase):
data = {
"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))
log.info(f"write {len(selected_collections)} collections to /tmp/ci_logs/all_collections.json")
collections_in_json = get_collections()
log.info(f"write {len(selected_collections)} collections to /tmp/ci_logs/chaos_test_all_collections.json")
collections_in_json = get_chaos_test_collections()
assert len(selected_collections) == len(collections_in_json)

View File

@ -44,7 +44,7 @@ def gen_search_param(index_type, metric_type="L2"):
return search_params
def get_collections():
def get_deploy_test_collections():
try:
with open("/tmp/ci_logs/deploy_test_all_collections.json", "r") as f:
data = json.load(f)
@ -52,4 +52,14 @@ def get_collections():
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)
collections = data["all"]
except Exception as e:
log.error(f"get_all_collections error: {e}")
return []
return collections

View File

@ -8,7 +8,7 @@ from common.common_type import CaseLabel, CheckTasks
from common.milvus_sys import MilvusSys
from utils.util_pymilvus import *
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
default_nb = ct.default_nb
@ -31,7 +31,7 @@ pymilvus_version = pymilvus.__version__
class TestActionSecondDeployment(TestDeployBase):
""" 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):
if request.param == [] or request.param == "":
pytest.skip("The collection name is invalid")

View File

@ -2,7 +2,7 @@ import json
import pytest
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 utils.util_log import test_log as log
@ -20,8 +20,8 @@ class TestGetCollections(TestcaseBase):
data = {
"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))
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)