[test]Update testcase (#19281)

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>

Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
pull/19311/head
zhuwenxing 2022-09-21 10:06:49 +08:00 committed by GitHub
parent fa45dee543
commit 68f8803a3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 9 deletions

View File

@ -14,6 +14,7 @@ from common.cus_resource_opts import CustomResourceOperations as CusResource
from utils.util_log import test_log as log
from chaos import chaos_commons as cc
from common import common_func as cf
from chaos.chaos_commons import assert_statistic
from common.common_type import CaseLabel
from chaos import constants
from delayed_assert import expect, assert_expectations
@ -97,7 +98,7 @@ class TestOperations(TestBase):
yield request.param
@pytest.mark.tags(CaseLabel.L3)
def test_operations(self):
def test_operations(self, request_duration, is_check):
# start the monitor threads to check the milvus ops
log.info("*********************Test Start**********************")
log.info(connections.get_connection_addr('default'))
@ -106,10 +107,13 @@ class TestOperations(TestBase):
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",""))
for i in range(10):
sleep(20)
sleep(request_duration//10)
for k,v in self.health_checkers.items():
v.check_result()
# log.info(v.check_result())
if is_check:
assert_statistic(self.health_checkers)
assert_expectations()
log.info("*********************Chaos Test Completed**********************")

View File

@ -11,8 +11,9 @@ from chaos.checker import (InsertChecker,
from utils.util_log import test_log as log
from chaos import chaos_commons as cc
from common.common_type import CaseLabel
from chaos.chaos_commons import assert_statistic
from chaos import constants
from delayed_assert import assert_expectations
class TestBase:
expect_create = constants.SUCC
@ -57,7 +58,7 @@ class TestOperations(TestBase):
self.health_checkers = checkers
@pytest.mark.tags(CaseLabel.L3)
def test_operations(self):
def test_operations(self, request_duration, is_check):
# start the monitor threads to check the milvus ops
log.info("*********************Test Start**********************")
log.info(connections.get_connection_addr('default'))
@ -66,9 +67,12 @@ class TestOperations(TestBase):
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",""))
for i in range(10):
sleep(20)
sleep(request_duration//10)
for k,v in self.health_checkers.items():
v.check_result()
if is_check:
assert_statistic(self.health_checkers)
assert_expectations()
log.info("*********************Chaos Test Completed**********************")

View File

@ -82,7 +82,7 @@ class TestOperations(TestBase):
self.health_checkers = checkers
@pytest.mark.tags(CaseLabel.L3)
def test_operations(self,collection_name):
def test_operations(self,collection_name, request_duration):
# start the monitor threads to check the milvus ops
log.info("*********************Test Start**********************")
log.info(connections.get_connection_addr('default'))
@ -90,9 +90,10 @@ 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
for i in range(10):
sleep(20)
sleep(request_duration//10)
for k,v in self.health_checkers.items():
v.check_result()
log.info("******assert after chaos deleted: ")