Merge pull request #29587 from taosdata/docs/readme-crashgen
doc: add Chaos Test to README and update some functions
This commit is contained in:
commit
320fcbf0ef
|
@ -81,7 +81,7 @@ Unit test script is the smallest testable part and developed for some function,
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd debug/build/bin
|
cd debug/build/bin
|
||||||
./osTimeTests
|
./osTimeTests
|
||||||
```
|
```
|
||||||
|
|
||||||
### How to run all unit test cases?
|
### How to run all unit test cases?
|
||||||
|
@ -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.
|
||||||
|
|
|
@ -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):
|
||||||
|
@ -371,7 +371,7 @@ Result: {msg_dict[status]}
|
||||||
Details
|
Details
|
||||||
Owner: Jayden Jia
|
Owner: Jayden Jia
|
||||||
Start time: {starttime}
|
Start time: {starttime}
|
||||||
End time: {endtime}
|
End time: {endtime}
|
||||||
Hostname: {hostname}
|
Hostname: {hostname}
|
||||||
Commit: {git_commit}
|
Commit: {git_commit}
|
||||||
Cmd: {cmd}
|
Cmd: {cmd}
|
||||||
|
@ -380,14 +380,13 @@ 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:
|
||||||
send_msg(alert_robot_url, get_msg(text))
|
send_msg(alert_robot_url, get_msg(text))
|
||||||
send_msg(notification_robot_url, get_msg(text))
|
send_msg(notification_robot_url, get_msg(text))
|
||||||
|
|
||||||
#send_msg(get_msg(text))
|
#send_msg(get_msg(text))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("exception:", e)
|
print("exception:", e)
|
||||||
exit(status)
|
exit(status)
|
||||||
|
|
|
@ -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):
|
||||||
|
@ -404,24 +404,24 @@ Result: {msg_dict[status]}
|
||||||
Details
|
Details
|
||||||
Owner: Jayden Jia
|
Owner: Jayden Jia
|
||||||
Start time: {starttime}
|
Start time: {starttime}
|
||||||
End time: {endtime}
|
End time: {endtime}
|
||||||
Hostname: {hostname}
|
Hostname: {hostname}
|
||||||
Commit: {git_commit}
|
Commit: {git_commit}
|
||||||
Cmd: {cmd}
|
Cmd: {cmd}
|
||||||
Log dir: {log_dir}
|
Log dir: {log_dir}
|
||||||
Core dir: {core_dir}
|
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:
|
||||||
send_msg(alert_robot_url, get_msg(text))
|
send_msg(alert_robot_url, get_msg(text))
|
||||||
send_msg(notification_robot_url, get_msg(text))
|
send_msg(notification_robot_url, get_msg(text))
|
||||||
|
|
||||||
#send_msg(get_msg(text))
|
#send_msg(get_msg(text))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("exception:", e)
|
print("exception:", e)
|
||||||
exit(status)
|
exit(status)
|
||||||
|
|
|
@ -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):
|
||||||
|
@ -388,28 +388,28 @@ def main():
|
||||||
|
|
||||||
text = f'''
|
text = f'''
|
||||||
Result: {msg_dict[status]}
|
Result: {msg_dict[status]}
|
||||||
|
|
||||||
Details
|
Details
|
||||||
Owner: Jayden Jia
|
Owner: Jayden Jia
|
||||||
Start time: {starttime}
|
Start time: {starttime}
|
||||||
End time: {endtime}
|
End time: {endtime}
|
||||||
Hostname: {hostname}
|
Hostname: {hostname}
|
||||||
Commit: {git_commit}
|
Commit: {git_commit}
|
||||||
Cmd: {cmd}
|
Cmd: {cmd}
|
||||||
Log dir: {log_dir}
|
Log dir: {log_dir}
|
||||||
Core dir: {core_dir}
|
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:
|
||||||
send_msg(alert_robot_url, get_msg(text))
|
send_msg(alert_robot_url, get_msg(text))
|
||||||
send_msg(notification_robot_url, get_msg(text))
|
send_msg(notification_robot_url, get_msg(text))
|
||||||
|
|
||||||
#send_msg(get_msg(text))
|
#send_msg(get_msg(text))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("exception:", e)
|
print("exception:", e)
|
||||||
exit(status)
|
exit(status)
|
||||||
|
|
|
@ -58,12 +58,12 @@ def checkRunTimeError():
|
||||||
if hwnd:
|
if hwnd:
|
||||||
os.system("TASKKILL /F /IM taosd.exe")
|
os.system("TASKKILL /F /IM taosd.exe")
|
||||||
|
|
||||||
#
|
#
|
||||||
# run case on previous cluster
|
# run case on previous cluster
|
||||||
#
|
#
|
||||||
def runOnPreviousCluster(host, config, fileName):
|
def runOnPreviousCluster(host, config, fileName):
|
||||||
print("enter run on previeous")
|
print("enter run on previeous")
|
||||||
|
|
||||||
# load case module
|
# load case module
|
||||||
sep = "/"
|
sep = "/"
|
||||||
if platform.system().lower() == 'windows':
|
if platform.system().lower() == 'windows':
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
@ -208,7 +210,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
if key in ['-R', '--restful']:
|
if key in ['-R', '--restful']:
|
||||||
restful = True
|
restful = True
|
||||||
|
|
||||||
if key in ['-W', '--websocket']:
|
if key in ['-W', '--websocket']:
|
||||||
websocket = True
|
websocket = True
|
||||||
|
|
||||||
|
@ -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
|
||||||
#
|
#
|
||||||
|
@ -405,7 +411,7 @@ if __name__ == "__main__":
|
||||||
for dnode in tdDnodes.dnodes:
|
for dnode in tdDnodes.dnodes:
|
||||||
tdDnodes.starttaosd(dnode.index)
|
tdDnodes.starttaosd(dnode.index)
|
||||||
tdCases.logSql(logSql)
|
tdCases.logSql(logSql)
|
||||||
|
|
||||||
if restful or websocket:
|
if restful or websocket:
|
||||||
tAdapter.deploy(adapter_cfg_dict)
|
tAdapter.deploy(adapter_cfg_dict)
|
||||||
tAdapter.start()
|
tAdapter.start()
|
||||||
|
@ -450,7 +456,7 @@ if __name__ == "__main__":
|
||||||
else:
|
else:
|
||||||
tdLog.debug(res)
|
tdLog.debug(res)
|
||||||
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
|
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
|
||||||
|
|
||||||
if ucase is not None and hasattr(ucase, 'noConn') and ucase.noConn == True:
|
if ucase is not None and hasattr(ucase, 'noConn') and ucase.noConn == True:
|
||||||
conn = None
|
conn = None
|
||||||
else:
|
else:
|
||||||
|
@ -640,7 +646,7 @@ if __name__ == "__main__":
|
||||||
else:
|
else:
|
||||||
tdLog.debug(res)
|
tdLog.debug(res)
|
||||||
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
|
tdLog.exit(f"alter queryPolicy to {queryPolicy} failed")
|
||||||
|
|
||||||
|
|
||||||
# run case
|
# run case
|
||||||
if testCluster:
|
if testCluster:
|
||||||
|
@ -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:
|
||||||
tdDnodes.stopAll()
|
if not crashGen:
|
||||||
|
tdDnodes.stopAll()
|
||||||
tdLog.info("stop all td process finished")
|
tdLog.info("stop all td process finished")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in New Issue