test case
This commit is contained in:
parent
ea6b16d5be
commit
74f1bb4ff9
|
@ -2,10 +2,12 @@ import taos
|
|||
import sys
|
||||
import datetime
|
||||
import inspect
|
||||
import threading
|
||||
|
||||
from util.log import *
|
||||
from util.sql import *
|
||||
from util.cases import *
|
||||
from util.common import tdCom
|
||||
import random
|
||||
|
||||
|
||||
|
@ -60,6 +62,33 @@ class TDTestCase:
|
|||
tdSql.query("show dnode 1 variables like '____debugFlag'")
|
||||
tdSql.checkRows(2)
|
||||
|
||||
def threadTest(self, threadID):
|
||||
print(f"Thread {threadID} starting...")
|
||||
tdsqln = tdCom.newTdSql()
|
||||
for i in range(100):
|
||||
tdsqln.query(f"desc db1.stb_1")
|
||||
tdsqln.checkRows(3)
|
||||
|
||||
print(f"Thread {threadID} finished.")
|
||||
|
||||
def case3(self):
|
||||
tdSql.execute("create database db1")
|
||||
tdSql.execute("create table db1.stb (ts timestamp, c1 varchar(100)) tags(t1 int)")
|
||||
tdSql.execute("create table db1.stb_1 using db1.stb tags(1)")
|
||||
|
||||
threads = []
|
||||
for i in range(10):
|
||||
t = threading.Thread(target=self.threadTest, args=(i,))
|
||||
threads.append(t)
|
||||
t.start()
|
||||
|
||||
for thread in threads:
|
||||
print(f"Thread waitting for finish...")
|
||||
thread.join()
|
||||
|
||||
print(f"Mutithread test finished.")
|
||||
|
||||
|
||||
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
||||
tdSql.prepare(replica = self.replicaVar)
|
||||
|
||||
|
@ -71,6 +100,10 @@ class TDTestCase:
|
|||
self.case2()
|
||||
tdLog.printNoPrefix("==========end case2 run ...............")
|
||||
|
||||
tdLog.printNoPrefix("==========start case3 run ...............")
|
||||
self.case3()
|
||||
tdLog.printNoPrefix("==========end case3 run ...............")
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
|
Loading…
Reference in New Issue