doc: add Chaos Test to README and update some functions

This commit is contained in:
jiajingbin 2025-01-16 16:22:17 +08:00
parent 9cd1113c93
commit 008233ccf6
5 changed files with 47 additions and 37 deletions

View File

@ -163,12 +163,16 @@ cd /root/TDengine/packaging/smokeTest
## 3.3 Chaos Test ## 3.3 Chaos Test
[Desciprtion] A simple tool to exercise various functions of the system in a randomized fashion, hoping to expose maximum number of problems, hopefully without a pre-determined scenario.
### How to run test? ### How to run test?
[Placeholder] ```bash
cd tests/pytest
python3 auto_crash_gen.py
```
### How to add new case? ### How to add new case?
[Placeholder] Add a function, such as TaskCreateNewFunction, to pytest/crash_gen/crash_gen_main.py.
Integrate TaskCreateNewFunction into the balance_pickTaskType function in crash_gen_main.py.

View File

@ -244,7 +244,7 @@ def start_taosd():
else: else:
pass pass
start_cmd = 'cd %s && python3 test.py >>/dev/null '%(start_path) start_cmd = 'cd %s && python3 test.py -G >>/dev/null '%(start_path)
os.system(start_cmd) os.system(start_cmd)
def get_cmds(args_list): def get_cmds(args_list):
@ -380,7 +380,6 @@ Core dir: {core_dir}
''' '''
text_result=text.split("Result: ")[1].split("Details")[0].strip() text_result=text.split("Result: ")[1].split("Details")[0].strip()
print(text_result) print(text_result)
if text_result == "success": if text_result == "success":
send_msg(notification_robot_url, get_msg(text)) send_msg(notification_robot_url, get_msg(text))
else: else:

View File

@ -245,7 +245,7 @@ def start_taosd():
else: else:
pass pass
start_cmd = 'cd %s && python3 test.py '%(start_path) start_cmd = 'cd %s && python3 test.py -G'%(start_path)
os.system(start_cmd +">>/dev/null") os.system(start_cmd +">>/dev/null")
def get_cmds(args_list): def get_cmds(args_list):

View File

@ -236,7 +236,7 @@ def start_taosd():
else: else:
pass pass
start_cmd = 'cd %s && python3 test.py -N 4 -M 1 '%(start_path) start_cmd = 'cd %s && python3 test.py -N 4 -M 1 -G '%(start_path)
os.system(start_cmd +">>/dev/null") os.system(start_cmd +">>/dev/null")
def get_cmds(args_list): def get_cmds(args_list):

View File

@ -113,8 +113,9 @@ if __name__ == "__main__":
asan = False asan = False
independentMnode = False independentMnode = False
previousCluster = False previousCluster = False
opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RWD:n:i:aP', [ crashGen = False
'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','websocket','adaptercfgupdate','replicaVar','independentMnode','previous']) opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RWD:n:i:aP:G', [
'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','websocket','adaptercfgupdate','replicaVar','independentMnode','previous',"crashGen"])
for key, value in opts: for key, value in opts:
if key in ['-h', '--help']: if key in ['-h', '--help']:
tdLog.printNoPrefix( tdLog.printNoPrefix(
@ -141,6 +142,7 @@ if __name__ == "__main__":
tdLog.printNoPrefix('-i independentMnode Mnode') tdLog.printNoPrefix('-i independentMnode Mnode')
tdLog.printNoPrefix('-a address sanitizer mode') tdLog.printNoPrefix('-a address sanitizer mode')
tdLog.printNoPrefix('-P run case with [P]revious cluster, do not create new cluster to run case.') tdLog.printNoPrefix('-P run case with [P]revious cluster, do not create new cluster to run case.')
tdLog.printNoPrefix('-G crashGen mode')
sys.exit(0) sys.exit(0)
@ -228,6 +230,10 @@ if __name__ == "__main__":
if key in ['-P', '--previous']: if key in ['-P', '--previous']:
previousCluster = True previousCluster = True
if key in ['-G', '--crashGen']:
crashGen = True
# #
# do exeCmd command # do exeCmd command
# #
@ -692,6 +698,7 @@ if __name__ == "__main__":
# tdDnodes.StopAllSigint() # tdDnodes.StopAllSigint()
tdLog.info("Address sanitizer mode finished") tdLog.info("Address sanitizer mode finished")
else: else:
if not crashGen:
tdDnodes.stopAll() tdDnodes.stopAll()
tdLog.info("stop all td process finished") tdLog.info("stop all td process finished")
sys.exit(0) sys.exit(0)