mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 10:59:32 +08:00
[test]Fix chaos testcases (#19320)
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com> Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
This commit is contained in:
parent
fc3309b8b8
commit
d379a23dae
@ -7,7 +7,8 @@ def pytest_addoption(parser):
|
||||
parser.addoption("--target_component", action="store", default="querynode", help="target_component")
|
||||
parser.addoption("--chaos_duration", action="store", default="1m", help="chaos_duration")
|
||||
parser.addoption("--chaos_interval", action="store", default="10s", help="chaos_interval")
|
||||
|
||||
parser.addoption("--request_duration", action="store", default="3m", help="request_duration")
|
||||
parser.addoption("--is_check", action="store", type=bool, default=False, help="is_check")
|
||||
|
||||
@pytest.fixture
|
||||
def milvus_ns(request):
|
||||
@ -31,3 +32,13 @@ def chaos_duration(request):
|
||||
@pytest.fixture
|
||||
def chaos_interval(request):
|
||||
return request.config.getoption("--chaos_interval")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def request_duration(request):
|
||||
return request.config.getoption("--request_duration")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def is_check(request):
|
||||
return request.config.getoption("--is_check")
|
@ -26,7 +26,7 @@ class TestAllCollection(TestcaseBase):
|
||||
@pytest.mark.tags(CaseLabel.L1)
|
||||
def test_milvus_default(self, collection_name):
|
||||
# create
|
||||
name = collection_name
|
||||
name = collection_name if collection_name else cf.gen_unique_str("Checker_")
|
||||
t0 = time.time()
|
||||
collection_w = self.init_collection_wrap(name=name, active_trace=True)
|
||||
tt = time.time() - t0
|
||||
|
@ -45,7 +45,7 @@ def get_all_collections():
|
||||
all_collections = data["all"]
|
||||
except Exception as e:
|
||||
log.error(f"get_all_collections error: {e}")
|
||||
return []
|
||||
return [None]
|
||||
return all_collections
|
||||
|
||||
|
||||
@ -98,16 +98,18 @@ class TestOperations(TestBase):
|
||||
yield request.param
|
||||
|
||||
@pytest.mark.tags(CaseLabel.L3)
|
||||
def test_operations(self, request_duration, is_check):
|
||||
def test_operations(self, request_duration, is_check, collection_name):
|
||||
# start the monitor threads to check the milvus ops
|
||||
log.info("*********************Test Start**********************")
|
||||
log.info(connections.get_connection_addr('default'))
|
||||
c_name = cf.gen_unique_str("Checker_")
|
||||
c_name = collection_name if collection_name else cf.gen_unique_str("Checker_")
|
||||
self.init_health_checkers(collection_name=c_name)
|
||||
cc.start_monitor_threads(self.health_checkers)
|
||||
log.info("*********************Load Start**********************")
|
||||
# wait 200s
|
||||
request_duration = eval(request_duration.replace("h","*3600+").replace("m","*60+").replace("s",""))
|
||||
request_duration = request_duration.replace("h","*3600+").replace("m","*60+").replace("s","")
|
||||
if request_duration[-1] == "+":
|
||||
request_duration = request_duration[:-1]
|
||||
request_duration = eval(request_duration)
|
||||
for i in range(10):
|
||||
sleep(request_duration//10)
|
||||
for k,v in self.health_checkers.items():
|
||||
|
@ -66,8 +66,11 @@ class TestOperations(TestBase):
|
||||
self.init_health_checkers(collection_name=c_name)
|
||||
cc.start_monitor_threads(self.health_checkers)
|
||||
log.info("*********************Load Start**********************")
|
||||
# wait 200s
|
||||
request_duration = eval(request_duration.replace("h","*3600+").replace("m","*60+").replace("s",""))
|
||||
# wait request_duration
|
||||
request_duration = request_duration.replace("h","*3600+").replace("m","*60+").replace("s","")
|
||||
if request_duration[-1] == "+":
|
||||
request_duration = request_duration[:-1]
|
||||
request_duration = eval(request_duration)
|
||||
for i in range(10):
|
||||
sleep(request_duration//10)
|
||||
for k,v in self.health_checkers.items():
|
||||
|
@ -90,8 +90,11 @@ class TestOperations(TestBase):
|
||||
self.init_health_checkers(collection_name=c_name)
|
||||
cc.start_monitor_threads(self.health_checkers)
|
||||
log.info("*********************Request Load Start**********************")
|
||||
request_duration = eval(request_duration.replace("h","*3600+").replace("m","*60+").replace("s",""))
|
||||
# wait 200s for the load request to be finished
|
||||
# wait request_duration for the load request to be finished
|
||||
request_duration = request_duration.replace("h","*3600+").replace("m","*60+").replace("s","")
|
||||
if request_duration[-1] == "+":
|
||||
request_duration = request_duration[:-1]
|
||||
request_duration = eval(request_duration)
|
||||
for i in range(10):
|
||||
sleep(request_duration//10)
|
||||
for k,v in self.health_checkers.items():
|
||||
|
Loading…
Reference in New Issue
Block a user