From bc48b2a91400ed164426479181995eac5d220771 Mon Sep 17 00:00:00 2001 From: yanliang567 <82361606+yanliang567@users.noreply.github.com> Date: Fri, 2 Jul 2021 15:24:17 +0800 Subject: [PATCH] Update tests20 tests (#6276) * [skip ci] Update test levels Signed-off-by: yanliang567 * [skip ci] Drop collections in self when teardown Signed-off-by: yanliang567 * [skip ci] Update search testcase Signed-off-by: yanliang567 * [skip ci] Open writing logs Signed-off-by: yanliang567 --- tests20/python_client/base/client_base.py | 23 +++++------ ...kill.yaml => skip_chaos_etcd_podkill.yaml} | 0 .../skip_chaos_pulsar_podkill.yaml | 17 ++++++++ tests20/python_client/chaos/test_chaos.py | 15 +++++-- tests20/python_client/load/README.md | 1 + .../testcases/test_collection.py | 12 +++--- .../testcases/test_connection.py | 22 +++++------ tests20/python_client/testcases/test_e2e.py | 39 +++++++++++++------ tests20/python_client/testcases/test_index.py | 4 +- .../python_client/testcases/test_insert.py | 2 +- .../python_client/testcases/test_partition.py | 10 ++--- tests20/python_client/testcases/test_query.py | 29 +++++++------- .../python_client/testcases/test_search.py | 5 +-- .../python_client/testcases/test_utility.py | 5 ++- 14 files changed, 111 insertions(+), 73 deletions(-) rename tests20/python_client/chaos/chaos_objects/{chaos_etcd_podkill.yaml => skip_chaos_etcd_podkill.yaml} (100%) create mode 100644 tests20/python_client/chaos/chaos_objects/skip_chaos_pulsar_podkill.yaml create mode 100644 tests20/python_client/load/README.md diff --git a/tests20/python_client/base/client_base.py b/tests20/python_client/base/client_base.py index 76a19f3039..c4b79f3d1b 100644 --- a/tests20/python_client/base/client_base.py +++ b/tests20/python_client/base/client_base.py @@ -47,16 +47,16 @@ class Base: log.info("[setup_class] Start setup class...") def teardown_class(self): + log.info("[teardown_class] Start teardown class...") pass def setup(self): log.info(("*" * 35) + " setup " + ("*" * 35)) self.connection_wrap = ApiConnectionsWrapper() + self.utility_wrap = ApiUtilityWrapper() self.collection_wrap = ApiCollectionWrapper() - self.collection_object_list.append(self.collection_wrap) self.partition_wrap = ApiPartitionWrapper() self.index_wrap = ApiIndexWrapper() - self.utility_wrap = ApiUtilityWrapper() self.collection_schema_wrap = ApiCollectionSchemaWrapper() self.field_schema_wrap = ApiFieldSchemaWrapper() @@ -68,19 +68,16 @@ class Base: if self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING)[0] is None: self.connection_wrap.connect(alias=DefaultConfig.DEFAULT_USING, host=param_info.param_host, port=param_info.param_port) + if self.collection_wrap.collection is not None: + self.collection_wrap.drop(check_task='check_nothing') for collection_object in self.collection_object_list: - if collection_object is not None and collection_object.collection is not None: - collection_object.drop() + if collection_object.collection is not None \ + and collection_object.name in self.utility_wrap.list_collections()[0]: + collection_object.drop(check_task='check_nothing') - # if self.collection_wrap is not None: - # collection_list = self.utility_wrap.list_collections()[0] - # for i in collection_list: - # collection_wrap = ApiCollectionWrapper() - # collection_wrap.init_collection(name=i) - # collection_wrap.drop() except Exception as e: - pass + log.debug(str(e)) try: """ Delete connection and reset configuration""" @@ -92,7 +89,7 @@ class Base: self.connection_wrap.add_connection(default={"host": DefaultConfig.DEFAULT_HOST, "port": DefaultConfig.DEFAULT_PORT}) except Exception as e: - pass + log.debug(str(e)) @pytest.fixture(scope="module", autouse=True) def initialize_env(self, request): @@ -140,8 +137,8 @@ class TestcaseBase(Base): if self.connection_wrap.get_connection(alias=DefaultConfig.DEFAULT_USING)[0] is None: self._connect() collection_w = ApiCollectionWrapper() - self.collection_object_list.append(collection_w) collection_w.init_collection(name=name, schema=schema, check_task=check_task, check_items=check_items, **kwargs) + self.collection_object_list.append(collection_w) return collection_w def init_partition_wrap(self, collection_wrap=None, name=None, description=None, diff --git a/tests20/python_client/chaos/chaos_objects/chaos_etcd_podkill.yaml b/tests20/python_client/chaos/chaos_objects/skip_chaos_etcd_podkill.yaml similarity index 100% rename from tests20/python_client/chaos/chaos_objects/chaos_etcd_podkill.yaml rename to tests20/python_client/chaos/chaos_objects/skip_chaos_etcd_podkill.yaml diff --git a/tests20/python_client/chaos/chaos_objects/skip_chaos_pulsar_podkill.yaml b/tests20/python_client/chaos/chaos_objects/skip_chaos_pulsar_podkill.yaml new file mode 100644 index 0000000000..2e504f9750 --- /dev/null +++ b/tests20/python_client/chaos/chaos_objects/skip_chaos_pulsar_podkill.yaml @@ -0,0 +1,17 @@ +apiVersion: chaos-mesh.org/v1alpha1 +kind: PodChaos +metadata: + name: test-proxy-podkill + namespace: chaos-testing +spec: + action: pod-kill + mode: one + selector: + namespaces: + - chaos-testing # target namespace of milvus deployment + labelSelectors: + app.kubernetes.io/instance: milvus-chaos + app.kubernetes.io/name: milvus + component: pulsar + scheduler: + cron: '@every 2s' diff --git a/tests20/python_client/chaos/test_chaos.py b/tests20/python_client/chaos/test_chaos.py index 39f89ec31f..f84c8ec3ab 100644 --- a/tests20/python_client/chaos/test_chaos.py +++ b/tests20/python_client/chaos/test_chaos.py @@ -10,18 +10,22 @@ from common import common_func as cf from chaos_commons import * from common.common_type import CaseLabel import constants +from delayed_assert import expect, assert_expectations def assert_statistic(checkers, expectations={}): for k in checkers.keys(): # expect succ if no expectations succ_rate = checkers[k].succ_rate() + total = checkers[k].total() if expectations.get(k, '') == constants.FAIL: - log.debug(f"Expect Fail: {str(k)} succ rate {succ_rate}, total: {checkers[k].total()}") - delayed_assert.expect(succ_rate < 0.49) + log.debug(f"Expect Fail: {str(k)} succ rate {succ_rate}, total: {total}") + expect(succ_rate < 0.49 or total < 2, + f"Expect Fail: {str(k)} succ rate {succ_rate}, total: {total}") else: - log.debug(f"Expect Succ: {str(k)} succ rate {succ_rate}, total: {checkers[k].total()}") - delayed_assert.expect(succ_rate > 0.90) + log.debug(f"Expect Succ: {str(k)} succ rate {succ_rate}, total: {total}") + expect(succ_rate > 0.90 or total > 2, + f"Expect Succ: {str(k)} succ rate {succ_rate}, total: {total}") class TestChaosBase: @@ -167,4 +171,7 @@ class TestChaos(TestChaosBase): log.debug("******3rd assert after chaos deleted: ") assert_statistic(self.health_checkers) + # assert all expectations + assert_expectations() + log.debug("*********************Chaos Test Completed**********************") diff --git a/tests20/python_client/load/README.md b/tests20/python_client/load/README.md new file mode 100644 index 0000000000..deeae0e24b --- /dev/null +++ b/tests20/python_client/load/README.md @@ -0,0 +1 @@ +# Load Test \ No newline at end of file diff --git a/tests20/python_client/testcases/test_collection.py b/tests20/python_client/testcases/test_collection.py index d61efe4ec6..bfe9c7a084 100644 --- a/tests20/python_client/testcases/test_collection.py +++ b/tests20/python_client/testcases/test_collection.py @@ -677,7 +677,7 @@ class TestCollectionParams(TestcaseBase): schema, _ = self.collection_schema_wrap.init_collection_schema(fields) assert not schema.auto_id - @pytest.mark.tags(CaseLabel.L0) + @pytest.mark.tags(CaseLabel.L1) def test_collection_auto_id_inconsistent(self): """ target: test collection auto_id with both collection schema and field schema @@ -747,7 +747,7 @@ class TestCollectionParams(TestcaseBase): self.field_schema_wrap.init_field_schema(name="int", dtype=DataType.INT64, auto_id=True, check_task=CheckTasks.err_res, check_items=error) - @pytest.mark.tags(CaseLabel.L0) + @pytest.mark.tags(CaseLabel.L1) @pytest.mark.parametrize("dtype", [DataType.FLOAT_VECTOR, DataType.BINARY_VECTOR]) def test_collection_vector_without_dim(self, dtype): """ @@ -1032,7 +1032,7 @@ class TestCollectionDataframe(TestcaseBase): self.collection_wrap.construct_from_dataframe(c_name, df, primary_field='A', check_task=CheckTasks.err_res, check_items=error) - @pytest.mark.tags(CaseLabel.L0) + @pytest.mark.tags(CaseLabel.L1) def test_construct_from_non_dataframe(self, get_non_df): """ target: test create collection by invalid dataframe @@ -1115,7 +1115,7 @@ class TestCollectionDataframe(TestcaseBase): self.collection_wrap.construct_from_dataframe(c_name, df, primary_field=ct.default_int64_field_name, auto_id=None, check_task=CheckTasks.err_res, check_items=error) - @pytest.mark.tags(CaseLabel.L0) + @pytest.mark.tags(CaseLabel.L1) def test_construct_auto_id_true_insert(self): """ target: test construct with true auto_id @@ -1129,7 +1129,7 @@ class TestCollectionDataframe(TestcaseBase): self.collection_wrap.construct_from_dataframe(c_name, df, primary_field=ct.default_int64_field_name, auto_id=True, check_task=CheckTasks.err_res, check_items=error) - @pytest.mark.tags(CaseLabel.L0) + @pytest.mark.tags(CaseLabel.L1) @pytest.mark.xfail(reason="#5967") def test_construct_auto_id_true_no_insert(self): """ @@ -1163,7 +1163,7 @@ class TestCollectionDataframe(TestcaseBase): assert cf._check_primary_keys(mutation_res.primary_keys, 100) assert self.collection_wrap.num_entities == nb - @pytest.mark.tags(CaseLabel.L0) + @pytest.mark.tags(CaseLabel.L1) def test_construct_auto_id_false(self): """ target: test construct with false auto_id diff --git a/tests20/python_client/testcases/test_connection.py b/tests20/python_client/testcases/test_connection.py index 09fae75a93..aa3335abcb 100644 --- a/tests20/python_client/testcases/test_connection.py +++ b/tests20/python_client/testcases/test_connection.py @@ -14,7 +14,7 @@ class TestConnectionParams(TestcaseBase): The author : Ting.Wang """ - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.parametrize("data", ct.get_dict_without_host_port) def test_connection_add_connection_kwargs_param_check(self, data): """ @@ -35,7 +35,7 @@ class TestConnectionParams(TestcaseBase): self.connection_wrap.list_connections(check_task=ct.CheckTasks.ccr, check_items={ct.list_content: [(DefaultConfig.DEFAULT_USING, None)]}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L1) def test_connection_connect_kwargs_param_check(self): """ target: test **kwargs of connect @@ -51,7 +51,7 @@ class TestConnectionParams(TestcaseBase): check_task=ct.CheckTasks.err_res, check_items={ct.err_code: 0, ct.err_msg: cem.NoHostPort}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.parametrize("alias", ct.get_not_string) def test_connection_connect_alias_param_check(self, alias): """ @@ -64,7 +64,7 @@ class TestConnectionParams(TestcaseBase): self.connection_wrap.connect(alias=alias, check_task=ct.CheckTasks.err_res, check_items={ct.err_code: 0, ct.err_msg: cem.AliasType % type(alias)}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.parametrize("alias", ct.get_not_string) def test_connection_get_alias_param_check(self, alias): """ @@ -77,7 +77,7 @@ class TestConnectionParams(TestcaseBase): self.connection_wrap.get_connection(alias=alias, check_task=ct.CheckTasks.err_res, check_items={ct.err_code: 0, ct.err_msg: cem.AliasType % type(alias)}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.parametrize("alias", ct.get_not_string) def test_connection_get_addr_alias_param_check(self, alias): """ @@ -90,7 +90,7 @@ class TestConnectionParams(TestcaseBase): self.connection_wrap.get_connection_addr(alias=alias, check_task=ct.CheckTasks.err_res, check_items={ct.err_code: 0, ct.err_msg: cem.AliasType % type(alias)}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.parametrize("alias", ct.get_not_string) def test_connection_remove_alias_param_check(self, alias): """ @@ -104,7 +104,7 @@ class TestConnectionParams(TestcaseBase): self.connection_wrap.remove_connection(alias=alias, check_task=ct.CheckTasks.err_res, check_items={ct.err_code: 0, ct.err_msg: cem.AliasType % type(alias)}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.parametrize("alias", ct.get_not_string) def test_connection_disconnect_alias_param_check(self, alias): """ @@ -231,7 +231,7 @@ class TestConnectionOperation(TestcaseBase): self.connection_wrap.get_connection_addr(alias=DefaultConfig.DEFAULT_USING, check_task=ct.CheckTasks.ccr, check_items={ct.dict_content: {'host': 'localhost', 'port': '19530'}}) - @pytest.mark.tags(ct.CaseLabel.L0) + @pytest.mark.tags(ct.CaseLabel.L1) def test_connection_add_cover_default(self): """ target: add a connection to override the default connection @@ -494,7 +494,7 @@ class TestConnectionOperation(TestcaseBase): self.connection_wrap.get_connection_addr(alias=connect_name, check_task=ct.CheckTasks.ccr, check_items={ct.dict_content: {'host': host, 'port': port}}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L1) @pytest.mark.parametrize("connect_name", [DefaultConfig.DEFAULT_USING, "test_alias_nme"]) def test_connection_connect_wrong_params(self, host, port, connect_name): """ @@ -518,7 +518,7 @@ class TestConnectionOperation(TestcaseBase): self.connection_wrap.get_connection_addr(alias=connect_name, check_task=ct.CheckTasks.ccr, check_items={ct.dict_content: dict_content}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.parametrize("connect_name", [DefaultConfig.DEFAULT_USING, ct.Not_Exist]) def test_connection_disconnect_not_exist(self, connect_name): """ @@ -542,7 +542,7 @@ class TestConnectionOperation(TestcaseBase): check_task=ct.CheckTasks.ccr, check_items={ct.dict_content: {"host": "localhost", "port": "19530"}}) - @pytest.mark.tags(ct.CaseLabel.L0) + @pytest.mark.tags(ct.CaseLabel.L1) def test_connection_disconnect_after_default_connect(self, host, port): """ target: disconnect default connect and check result diff --git a/tests20/python_client/testcases/test_e2e.py b/tests20/python_client/testcases/test_e2e.py index f290086ff7..63fda7f2cf 100644 --- a/tests20/python_client/testcases/test_e2e.py +++ b/tests20/python_client/testcases/test_e2e.py @@ -1,3 +1,4 @@ +import datetime import pytest from base.client_base import TestcaseBase @@ -10,45 +11,59 @@ prefix = "e2e_" class TestE2e(TestcaseBase): """ Test case of end to end""" - @pytest.mark.tags(CaseLabel.L1) + @pytest.mark.tags(CaseLabel.L2) @pytest.mark.parametrize("name", [(cf.gen_unique_str(prefix))]) def test_milvus_default(self, name): from utils.util_log import test_log as log # create + t0 = datetime.datetime.now() collection_w = self.init_collection_wrap(name=name) - log.debug("assert create") + tt = datetime.datetime.now() - t0 + log.debug(f"assert create: {tt}") assert collection_w.name == name # insert data = cf.gen_default_list_data() + t0 = datetime.datetime.now() _, res = collection_w.insert(data) - log.debug("assert insert") + tt = datetime.datetime.now() - t0 + log.debug(f"assert insert: {tt}") assert res # flush - log.debug("assert flush") + t0 = datetime.datetime.now() assert collection_w.num_entities == len(data[0]) + tt = datetime.datetime.now() - t0 + log.debug(f"assert flush: {tt}") # search collection_w.load() search_vectors = cf.gen_vectors(1, ct.default_dim) + t0 = datetime.datetime.now() res_1, _ = collection_w.search(data=search_vectors, anns_field=ct.default_float_vec_field_name, param={"nprobe": 16}, limit=1) - log.debug("assert search") + tt = datetime.datetime.now() - t0 + log.debug(f"assert search: {tt}") assert len(res_1) == 1 + # collection_w.release() # index - collection_w.insert(cf.gen_default_dataframe_data(nb=4000)) - assert collection_w.num_entities == len(data[0]) + 4000 + collection_w.insert(cf.gen_default_dataframe_data(nb=5000)) + assert collection_w.num_entities == len(data[0]) + 5000 _index_params = {"index_type": "IVF_SQ8", "metric_type": "L2", "params": {"nlist": 64}} + t0 = datetime.datetime.now() index, _ = collection_w.create_index(field_name=ct.default_float_vec_field_name, index_params=_index_params, name=cf.gen_unique_str()) - log.debug("assert index") + tt = datetime.datetime.now() - t0 + log.debug(f"assert index: {tt}") assert len(collection_w.indexes) == 1 - # # query - # term_expr = f'{ct.default_int64_field_name} in [1,2,3,4]' - # res, _ = collection_w.query(term_expr) - # assert len(res) == 4 + # query + term_expr = f'{ct.default_int64_field_name} in [3001,4001,4999,2999]' + t0 = datetime.datetime.now() + res, _ = collection_w.query(term_expr) + tt = datetime.datetime.now() - t0 + log.debug(f"assert query: {tt}") + assert len(res) == 4 diff --git a/tests20/python_client/testcases/test_index.py b/tests20/python_client/testcases/test_index.py index 0da1ab683c..0180558df8 100644 --- a/tests20/python_client/testcases/test_index.py +++ b/tests20/python_client/testcases/test_index.py @@ -345,7 +345,7 @@ class TestIndexAdvanced(TestcaseBase): """ pass - @pytest.mark.tags(CaseLabel.L3) + @pytest.mark.tags(CaseLabel.L2) def _test_index_recovery_after_restart(self): """ target: test index still existed after server restart @@ -354,7 +354,7 @@ class TestIndexAdvanced(TestcaseBase): """ pass - @pytest.mark.tags(CaseLabel.L3) + @pytest.mark.tags(CaseLabel.L2) def _test_index_building_after_restart(self): """ target: index can still build if not finished before server restart diff --git a/tests20/python_client/testcases/test_insert.py b/tests20/python_client/testcases/test_insert.py index 2c9d71959d..f175880ef6 100644 --- a/tests20/python_client/testcases/test_insert.py +++ b/tests20/python_client/testcases/test_insert.py @@ -541,7 +541,7 @@ class TestInsertOperation(TestcaseBase): assert cf._check_primary_keys(primary_keys, nb * 2) assert collection_w.num_entities == nb * 2 - @pytest.mark.tags(CaseLabel.L0) + @pytest.mark.tags(CaseLabel.L1) def test_insert_auto_id_true_list_data(self): """ target: test insert ids fields values when auto_id=True diff --git a/tests20/python_client/testcases/test_partition.py b/tests20/python_client/testcases/test_partition.py index fdce87a1b9..0dbdcd3d63 100644 --- a/tests20/python_client/testcases/test_partition.py +++ b/tests20/python_client/testcases/test_partition.py @@ -138,7 +138,7 @@ class TestPartitionParams(TestcaseBase): ) assert collection_w.has_partition(partition_name)[0] - @pytest.mark.tags(CaseLabel.L1) + @pytest.mark.tags(CaseLabel.L0) def test_partition_default_name(self): """ target: verify create a partition with default name @@ -412,7 +412,7 @@ class TestPartitionOperations(TestcaseBase): check_items={ct.err_code: 1, ct.err_msg: "maximum partition's number should be limit to 4096"}) - @pytest.mark.tags(CaseLabel.L1) + @pytest.mark.tags(CaseLabel.L0) @pytest.mark.parametrize("partition_name", [ct.default_partition_name]) def test_partition_drop_default_partition(self, partition_name): """ @@ -455,7 +455,7 @@ class TestPartitionOperations(TestcaseBase): # verify that drop the partition again with exception partition_w.drop(check_task=CheckTasks.err_res, - check_items={ct.err_code: 1, ct.err_msg: "Partition doesn't exist"}) + check_items={ct.err_code: 1, ct.err_msg: "Partition not exist"}) @pytest.mark.tags(CaseLabel.L2) @pytest.mark.parametrize("partition_name", [cf.gen_unique_str(prefix)]) @@ -578,7 +578,7 @@ class TestPartitionOperations(TestcaseBase): # release the dropped partition and check err response partition_w.release(check_task=CheckTasks.err_res, - check_items={ct.err_code: 1, ct.err_msg: "Partition doesn't exist"}) + check_items={ct.err_code: 1, ct.err_msg: "Partition not exist"}) @pytest.mark.tags(CaseLabel.L1) @pytest.mark.parametrize("partition_name", [cf.gen_unique_str(prefix)]) @@ -690,7 +690,7 @@ class TestPartitionOperations(TestcaseBase): # insert data to partition partition_w.insert(cf.gen_default_dataframe_data(), check_task=CheckTasks.err_res, - check_items={ct.err_code: 1, ct.err_msg: "Partition doesn't exist"}) + check_items={ct.err_code: 1, ct.err_msg: "Partition not exist"}) # TODO: update the assert error @pytest.mark.tags(CaseLabel.L1) diff --git a/tests20/python_client/testcases/test_query.py b/tests20/python_client/testcases/test_query.py index 5a3e2ef0cf..0da697bd50 100644 --- a/tests20/python_client/testcases/test_query.py +++ b/tests20/python_client/testcases/test_query.py @@ -440,7 +440,7 @@ class TestQueryOperation(TestcaseBase): ****************************************************************** """ - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) @pytest.mark.parametrize("collection_name", [cf.gen_unique_str(prefix)]) def test_query_without_connection(self, collection_name): """ @@ -462,7 +462,7 @@ class TestQueryOperation(TestcaseBase): collection_w.query(default_term_expr, check_task=CheckTasks.err_res, check_items={ct.err_code: 0, ct.err_msg: cem.ConnectFirst}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L1) @pytest.mark.parametrize("collection_name, data", [(cf.gen_unique_str(prefix), cf.gen_default_list_data(ct.default_nb))]) def test_query_without_loading(self, collection_name, data): @@ -485,7 +485,7 @@ class TestQueryOperation(TestcaseBase): collection_w.query(default_term_expr, check_task=CheckTasks.err_res, check_items={ct.err_code: 1, ct.err_msg: clem.CollNotLoaded % collection_name}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L1) @pytest.mark.parametrize("term_expr", [f'{ct.default_int64_field_name} in [0]']) def test_query_expr_single_term_array(self, term_expr): """ @@ -501,7 +501,7 @@ class TestQueryOperation(TestcaseBase): check_vec = vectors[0].iloc[:, [0, 1]][0:1].to_dict('records') collection_w.query(term_expr, check_task=CheckTasks.check_query_results, check_items={exp_res: check_vec}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L1) @pytest.mark.parametrize("term_expr", [f'{ct.default_int64_field_name} in [0]']) def test_query_binary_expr_single_term_array(self, term_expr, check_content): """ @@ -518,7 +518,7 @@ class TestQueryOperation(TestcaseBase): check_vec = vectors[0].iloc[:, [0, 1]][0:1].to_dict('records') collection_w.query(term_expr, check_task=CheckTasks.check_query_results, check_items={exp_res: check_vec}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) def test_query_expr_all_term_array(self): """ target: test query with all array term expr @@ -537,7 +537,7 @@ class TestQueryOperation(TestcaseBase): # query all array value collection_w.query(term_expr, check_task=CheckTasks.check_query_results, check_items={exp_res: check_vec}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L1) def test_query_expr_half_term_array(self): """ target: test query with half array term expr @@ -554,7 +554,7 @@ class TestQueryOperation(TestcaseBase): assert len(res) == len(int_values) @pytest.mark.xfail(reason="fail") - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) def test_query_expr_repeated_term_array(self): """ target: test query with repeated term array on primary field with unique value @@ -568,7 +568,7 @@ class TestQueryOperation(TestcaseBase): assert len(res) == 1 assert res[0][ct.default_int64_field_name] == int_values[0] - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L0) def test_query_after_index(self): """ target: test query after creating index @@ -589,7 +589,7 @@ class TestQueryOperation(TestcaseBase): check_vec = vectors[0].iloc[:, [0, 1]][0:len(int_values)].to_dict('records') collection_w.query(term_expr, check_task=CheckTasks.check_query_results, check_items={exp_res: check_vec}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L1) def test_query_after_search(self): """ target: test query after search @@ -606,7 +606,7 @@ class TestQueryOperation(TestcaseBase): collection_w.search(vectors_s[:ct.default_nq], ct.default_float_vec_field_name, ct.default_search_params, limit, "int64 >= 0", check_task=CheckTasks.check_search_results, - check_items={"nq": ct.default_nq, "limit": nb_old}) + check_items={"nq": ct.default_nq, "limit": nb_old, "nb": nb_old}) # check number of entities and that method calls the flush interface assert collection_w.num_entities == nb_old @@ -615,7 +615,7 @@ class TestQueryOperation(TestcaseBase): check_vec = vectors[0].iloc[:, [0, 1]][0:2].to_dict('records') collection_w.query(term_expr, check_task=CheckTasks.check_query_results, check_items={exp_res: check_vec}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) def test_query_partition_repeatedly(self): """ target: test query repeatedly on partition @@ -647,7 +647,7 @@ class TestQueryOperation(TestcaseBase): res_two, _ = collection_w.query(default_term_expr, partition_names=[partition_w.name]) assert res_one == res_two - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) def test_query_another_partition(self): """ target: test query another partition @@ -663,7 +663,7 @@ class TestQueryOperation(TestcaseBase): collection_w.query(term_expr, partition_names=[partition_w.name], check_task=CheckTasks.check_query_results, check_items={exp_res: []}) - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) def test_query_multi_partitions_multi_results(self): """ target: test query on multi partitions and get multi results @@ -679,7 +679,7 @@ class TestQueryOperation(TestcaseBase): res, _ = collection_w.query(term_expr, partition_names=[ct.default_partition_name, partition_w.name]) assert len(res) == 2 - @pytest.mark.tags(ct.CaseLabel.L3) + @pytest.mark.tags(ct.CaseLabel.L2) def test_query_multi_partitions_single_result(self): """ target: test query on multi partitions and get single result @@ -696,6 +696,7 @@ class TestQueryOperation(TestcaseBase): assert len(res) == 1 assert res[0][ct.default_int64_field_name] == half + @pytest.mark.tags(ct.CaseLabel.L2) def insert_entities_into_two_partitions_in_half(self, half): """ insert default entities into two partitions(partition_w and _default) in half(int64 and float fields values) diff --git a/tests20/python_client/testcases/test_search.py b/tests20/python_client/testcases/test_search.py index 2a6d646fb9..2eb5277dd1 100644 --- a/tests20/python_client/testcases/test_search.py +++ b/tests20/python_client/testcases/test_search.py @@ -447,7 +447,7 @@ class TestCollectionSearch(TestcaseBase): check_task=CheckTasks.check_search_results, check_items={"nq": 0}) - @pytest.mark.tags(CaseLabel.L0) + @pytest.mark.tags(CaseLabel.L1) def test_search_before_after_delete(self): """ target: test search function before and after deletion @@ -747,7 +747,7 @@ class TestCollectionSearch(TestcaseBase): "nb": default_nb, "limit": default_limit}) - @pytest.mark.tags(CaseLabel.L0) + @pytest.mark.tags(CaseLabel.L1) def test_search_collection_multiple_times(self): """ target: test search for multiple times @@ -1127,7 +1127,6 @@ class TestCollectionSearch(TestcaseBase): "limit": default_limit}) @pytest.mark.tags(CaseLabel.L2) - @pytest.mark.timeout(300) def test_search_concurrent_multi_threads(self): """ target: test concurrent search with multi-processes diff --git a/tests20/python_client/testcases/test_utility.py b/tests20/python_client/testcases/test_utility.py index a984d0f62a..87585f86cf 100644 --- a/tests20/python_client/testcases/test_utility.py +++ b/tests20/python_client/testcases/test_utility.py @@ -161,7 +161,7 @@ class TestUtilityBase(TestcaseBase): res, _ = self.utility_wrap.has_collection(cw.name) assert res is True - @pytest.mark.tags(CaseLabel.L1) + @pytest.mark.tags(CaseLabel.L2) def test_has_collection_not_created(self): """ target: test has_collection with collection name which is not created @@ -188,7 +188,7 @@ class TestUtilityBase(TestcaseBase): res, _ = self.utility_wrap.has_collection(c_name) assert res is False - @pytest.mark.tags(CaseLabel.L1) + @pytest.mark.tags(CaseLabel.L2) def test_has_partition(self): """ target: test has_partition with partition name @@ -368,6 +368,7 @@ class TestUtilityBase(TestcaseBase): assert res is None @pytest.mark.tags(CaseLabel.L1) + @pytest.mark.skip(reason='hang issue #6272') def test_wait_index_collection_index(self): """ target: test wait_index