diff --git a/tests/pytest/insert/schemalessInsert.py b/tests/pytest/insert/schemalessInsert.py index 5c93095a1ee414a1559f48595a3e2e412463e829..88abea477a9f1b458dc17c93c27d68934f5af03f 100644 --- a/tests/pytest/insert/schemalessInsert.py +++ b/tests/pytest/insert/schemalessInsert.py @@ -705,7 +705,7 @@ class TDTestCase: case no id when stb exist """ self.cleanStb() - input_sql, stb_name = self.genFullTypeSql(t0="f", c0="f") + input_sql, stb_name = self.genFullTypeSql(tb_name="sub_table_0123456", t0="f", c0="f") self.resCmp(input_sql, stb_name) input_sql, stb_name = self.genFullTypeSql(stb_name=stb_name, id_noexist_tag=True, t0="f", c0="f") self.resCmp(input_sql, stb_name, condition='where tbname like "t_%"') diff --git a/tests/pytest/manualTest/cal_unavaliable_time_kill.py b/tests/pytest/manualTest/cal_unavaliable_time_kill.py new file mode 100644 index 0000000000000000000000000000000000000000..a4ffc2506f9aae956e16d68fe52e30a15494301f --- /dev/null +++ b/tests/pytest/manualTest/cal_unavaliable_time_kill.py @@ -0,0 +1,50 @@ +# -*-coding: utf-8-*- +# for TD-5159 +import time +import taos +import sys, time, os, re, platform +from RemoteModule import RemoteModule +class Cal(): + def __init__(self): + master_ip = "192.168.1.189" + master_ssh_port = "22" + ssh_user = "root" + ssh_passwd = "tbase125!" + log_dir = "" + remote_dir = "" + self.RM_master = RemoteModule(master_ip, master_ssh_port, ssh_user, ssh_passwd, log_dir, remote_dir) + + def execShellCmd(self, shell_cmd): + result = os.popen(shell_cmd).read().strip() + return result + + def caltimeFromKill(self): + try: + conn = taos.connect(host="127.0.0.1", user="root", password="taosdata", config="/home/ubuntu/abt_taos") + while "failed" in str(conn): + conn = taos.connect(host="127.0.0.1", user="root", password="taosdata", config="/home/ubuntu/abt_taos") + if "failed" not in str(conn): + break + c1 = conn.cursor() + c1.execute("use test") + insert_tag = 0 + times = 0 + self.RM_master.exec_cmd('ps -ef | grep taosd | grep -v grep | awk \'{print $2}\' | xargs sudo kill -9') + start_time = time.time() + while insert_tag == 0 and times < 10: + insert_res = c1.execute('insert into stb_22 values (now,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)') + if insert_res == 1: + insert_tag = 1 + end_time = time.time() + break + else: + times += 1 + use_time = end_time - start_time + print(use_time) + return use_time + except Exception: + print("last failed") +if __name__ == '__main__': + cal = Cal() + cal.caltimeFromKill() + diff --git a/tests/pytest/manualTest/cal_unavaliable_time_stop.py b/tests/pytest/manualTest/cal_unavaliable_time_stop.py new file mode 100644 index 0000000000000000000000000000000000000000..2c60bb69fb95bfffd9bf7c8904eb8b72a7569b68 --- /dev/null +++ b/tests/pytest/manualTest/cal_unavaliable_time_stop.py @@ -0,0 +1,47 @@ +# -*-coding: utf-8-*- +# for TD-5159 +import time +import taos +import sys, time, os, re, platform +from RemoteModule import RemoteModule +class Cal(): + def __init__(self): + master_ip = "192.168.1.189" + master_ssh_port = "22" + #ssh_user = "ubuntu" + ssh_user = "root" + #ssh_passwd = "1" + ssh_passwd = "tbase125!" + log_dir = "" + remote_dir = "" + self.RM_master = RemoteModule(master_ip, master_ssh_port, ssh_user, ssh_passwd, log_dir, remote_dir) + + def execShellCmd(self, shell_cmd): + result = os.popen(shell_cmd).read().strip() + return result + + def caltimeFromKill(self): + try: + self.RM_master.exec_cmd('screen -d -m systemctl stop taosd') + start_time = time.time() + res = self.execShellCmd('taos -c /home/ubuntu/abt_taos -s "use test; insert into stb_22 values (now,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);"') + end_time_shell = time.time() + shell_time = end_time_shell - start_time_shell + if "failed" not in str(res): + break + print(f'shell_time --- {shell_time}') + sql_time = str(res).split("database")[-1].replace('(', "").replace(')', "").replace('s', "").strip() + print(f'sql_time----{sql_time}') + end_time = time.time() + use_time = end_time - start_time - float(shell_time) + float(sql_time) + print(f'use_time---{use_time}') + return use_time + except Exception: + print("failed") +if __name__ == '__main__': + cal = Cal() + cal.caltimeFromKill() +