test case
This commit is contained in:
parent
ea6b16d5be
commit
74f1bb4ff9
|
@ -2,10 +2,12 @@ import taos
|
||||||
import sys
|
import sys
|
||||||
import datetime
|
import datetime
|
||||||
import inspect
|
import inspect
|
||||||
|
import threading
|
||||||
|
|
||||||
from util.log import *
|
from util.log import *
|
||||||
from util.sql import *
|
from util.sql import *
|
||||||
from util.cases import *
|
from util.cases import *
|
||||||
|
from util.common import tdCom
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,6 +62,33 @@ class TDTestCase:
|
||||||
tdSql.query("show dnode 1 variables like '____debugFlag'")
|
tdSql.query("show dnode 1 variables like '____debugFlag'")
|
||||||
tdSql.checkRows(2)
|
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
|
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
||||||
tdSql.prepare(replica = self.replicaVar)
|
tdSql.prepare(replica = self.replicaVar)
|
||||||
|
|
||||||
|
@ -70,6 +99,10 @@ class TDTestCase:
|
||||||
tdLog.printNoPrefix("==========start case2 run ...............")
|
tdLog.printNoPrefix("==========start case2 run ...............")
|
||||||
self.case2()
|
self.case2()
|
||||||
tdLog.printNoPrefix("==========end case2 run ...............")
|
tdLog.printNoPrefix("==========end case2 run ...............")
|
||||||
|
|
||||||
|
tdLog.printNoPrefix("==========start case3 run ...............")
|
||||||
|
self.case3()
|
||||||
|
tdLog.printNoPrefix("==========end case3 run ...............")
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
Loading…
Reference in New Issue