From 556277616be16c1874e661aec52b0426cf84f035 Mon Sep 17 00:00:00 2001 From: ThreadDao Date: Mon, 1 Nov 2021 17:43:50 +0800 Subject: [PATCH] [skip ci] Test chaos memory stress querynode (#11018) Signed-off-by: ThreadDao --- .../chaos_querynode_memory_stress.yaml | 3 +- .../chaos/test_chaos_memory_stress.py | 33 +++++++------------ 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/tests/python_client/chaos/chaos_objects/memory_stress/chaos_querynode_memory_stress.yaml b/tests/python_client/chaos/chaos_objects/memory_stress/chaos_querynode_memory_stress.yaml index 282219fbc..17be18d07 100644 --- a/tests/python_client/chaos/chaos_objects/memory_stress/chaos_querynode_memory_stress.yaml +++ b/tests/python_client/chaos/chaos_objects/memory_stress/chaos_querynode_memory_stress.yaml @@ -15,4 +15,5 @@ spec: stressors: memory: workers: 4 - size: 1000MB \ No newline at end of file + size: 512Mi + duration: 5m \ No newline at end of file diff --git a/tests/python_client/chaos/test_chaos_memory_stress.py b/tests/python_client/chaos/test_chaos_memory_stress.py index 538bd970a..4a8f555eb 100644 --- a/tests/python_client/chaos/test_chaos_memory_stress.py +++ b/tests/python_client/chaos/test_chaos_memory_stress.py @@ -57,37 +57,28 @@ class TestChaosData: 6. release and reload collection, verify search and query is available expected: after chaos deleted, load, search and query qre both available """ - c_name = cf.gen_unique_str('chaos_memory') - collection_w = construct_from_data(c_name) + c_name = 'chaos_memory_nx6DNW4q' + collection_w = ApiCollectionWrapper() + collection_w.init_collection(c_name) log.debug(collection_w.schema) + log.debug(collection_w._shards_num) # apply memory stress - apply_memory_stress(chaos_yaml) + # apply_memory_stress(chaos_yaml) # wait memory stress - sleep(constants.WAIT_PER_OP * 2) - - # query - collection_w.release() - collection_w.load() - term_expr = f'{ct.default_int64_field_name} in [0, 1, 999, 99]' - t0 = datetime.datetime.now() - query_res, _ = collection_w.query(term_expr) - tt = datetime.datetime.now() - t0 - log.info(f"assert query: {tt}") - assert len(query_res) == 4 - - sleep(constants.WAIT_PER_OP * 5) + # sleep(constants.WAIT_PER_OP * 2) # query collection_w.release() collection_w.load() term_expr = f'{ct.default_int64_field_name} in [0, 1, 999, 99]' - t0 = datetime.datetime.now() - query_res, _ = collection_w.query(term_expr) - tt = datetime.datetime.now() - t0 - log.info(f"assert query: {tt}") - assert len(query_res) == 4 + for i in range(4): + t0_query = datetime.datetime.now() + query_res, _ = collection_w.query(term_expr) + tt_query = datetime.datetime.now() - t0_query + log.info(f"{i} query cost: {tt_query}") + assert len(query_res) == 4 @pytest.mark.tags(CaseLabel.L3) @pytest.mark.parametrize('chaos_yaml', get_chaos_yamls()) -- GitLab