[skip ci]Parser expect for cluster_n_node mode (#10317)

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
pull/10324/head
zhuwenxing 2021-10-20 20:52:35 +08:00 committed by GitHub
parent 199aff607a
commit e0291df43d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -5,6 +5,7 @@ from pymilvus import connections
from chaos.checker import (CreateChecker, InsertFlushChecker, from chaos.checker import (CreateChecker, InsertFlushChecker,
SearchChecker, QueryChecker, IndexChecker, Op) SearchChecker, QueryChecker, IndexChecker, Op)
from common.cus_resource_opts import CustomResourceOperations as CusResource from common.cus_resource_opts import CustomResourceOperations as CusResource
from common.milvus_sys import MilvusSys
from utils.util_log import test_log as log from utils.util_log import test_log as log
from chaos import chaos_commons as cc from chaos import chaos_commons as cc
from common.common_type import CaseLabel from common.common_type import CaseLabel
@ -44,10 +45,20 @@ class TestChaosBase:
tests_yaml = constants.TESTS_CONFIG_LOCATION + 'testcases.yaml' tests_yaml = constants.TESTS_CONFIG_LOCATION + 'testcases.yaml'
tests_config = cc.gen_experiment_config(tests_yaml) tests_config = cc.gen_experiment_config(tests_yaml)
test_collections = tests_config.get('Collections', None) test_collections = tests_config.get('Collections', None)
ms = MilvusSys(alias="default")
node_map = {
"querynode": "query_nodes",
"datanode": "data_nodes",
"indexnode": "index_nodes"
}
for t in test_collections: for t in test_collections:
test_chaos = t.get('testcase', {}).get('chaos', {}) test_chaos = t.get('testcase', {}).get('chaos', {})
if test_chaos in chaos_yaml: if test_chaos in chaos_yaml:
expects = t.get('testcase', {}).get('expectation', {}).get('cluster_1_node', {}) expects = t.get('testcase', {}).get('expectation', {}).get('cluster_1_node', {})
# for cluster_n_node mode
for node in node_map.keys():
if node in test_chaos and len(getattr(ms, node_map[node])) > 1:
expects = t.get('testcase', {}).get('expectation', {}).get('cluster_n_node', {})
log.info(f"yaml.expects: {expects}") log.info(f"yaml.expects: {expects}")
self.expect_create = expects.get(Op.create.value, constants.SUCC) self.expect_create = expects.get(Op.create.value, constants.SUCC)
self.expect_insert = expects.get(Op.insert.value, constants.SUCC) self.expect_insert = expects.get(Op.insert.value, constants.SUCC)