未验证 提交 9640e6f1 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-14331]<fix>: make util/dnodes.py flexible (#11020)

* [TD-14331]<fix>: make util/dnodes.py flexible

* fix 5-taos-tools/basic.py

* fix 5-taos-tools/basic.py typo

* make util/dnodes.py getPath logic clear

* fix a few files

* fix a few taosdump/taosdemo test cases
上级 60b68dcf
...@@ -27,7 +27,7 @@ class TDTestCase: ...@@ -27,7 +27,7 @@ class TDTestCase:
self.numberOfTables = 1000 self.numberOfTables = 1000
self.numberOfRecords = 100 self.numberOfRecords = 100
def getBuildPath(self): def getPath(self, tool="taosBenchmark"):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
...@@ -35,23 +35,23 @@ class TDTestCase: ...@@ -35,23 +35,23 @@ class TDTestCase:
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ("taosd" in files): if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")] paths.append(os.path.join(root, tool))
break break
return buildPath return paths[0]
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
buildPath = self.getBuildPath() binPath = self.getPath("taosBenchmark")
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosdemo not found!") tdLog.exit("taosBenchmark not found!")
else: else:
tdLog.info("taosdemo found in %s" % buildPath) tdLog.info("taosBenchmark found: %s" % binPath)
binPath = buildPath + "/build/bin/" os.system("%s -y -t %d -n %d -b INT,INT,INT,INT" %
os.system("%staosBenchmark -y -t %d -n %d -b INT,INT,INT,INT" %
(binPath, self.numberOfTables, self.numberOfRecords)) (binPath, self.numberOfTables, self.numberOfRecords))
tdSql.execute("use test") tdSql.execute("use test")
......
...@@ -35,7 +35,7 @@ class TDTestCase: ...@@ -35,7 +35,7 @@ class TDTestCase:
else: else:
return True return True
def getBuildPath(self): def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
...@@ -43,13 +43,14 @@ class TDTestCase: ...@@ -43,13 +43,14 @@ class TDTestCase:
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ("taosdump" in files): if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")] paths.append(os.path.join(root, tool))
break break
return buildPath return paths[0]
def run(self): def run(self):
if not os.path.exists("./taosdumptest/tmp1"): if not os.path.exists("./taosdumptest/tmp1"):
...@@ -78,16 +79,15 @@ class TDTestCase: ...@@ -78,16 +79,15 @@ class TDTestCase:
sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100) sql += "(%d, %d, 'nchar%d')" % (currts + i, i % 100, i % 100)
tdSql.execute(sql) tdSql.execute(sql)
buildPath = self.getBuildPath() binPath = self.getPath()
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosdump not found!") tdLog.exit("taosdump not found!")
else: else:
tdLog.info("taosdump found in %s" % buildPath) tdLog.info("taosdump found: %s" % binPath)
binPath = buildPath + "/build/bin/"
os.system("%staosdump --databases db -o ./taosdumptest/tmp1" % binPath) os.system("%s --databases db -o ./taosdumptest/tmp1" % binPath)
os.system( os.system(
"%staosdump --databases db1 -o ./taosdumptest/tmp2" % "%s --databases db1 -o ./taosdumptest/tmp2" %
binPath) binPath)
tdSql.execute("drop database db") tdSql.execute("drop database db")
...@@ -95,8 +95,8 @@ class TDTestCase: ...@@ -95,8 +95,8 @@ class TDTestCase:
tdSql.query("show databases") tdSql.query("show databases")
tdSql.checkRows(0) tdSql.checkRows(0)
os.system("%staosdump -i ./taosdumptest/tmp1" % binPath) os.system("%s -i ./taosdumptest/tmp1" % binPath)
os.system("%staosdump -i ./taosdumptest/tmp2" % binPath) os.system("%s -i ./taosdumptest/tmp2" % binPath)
tdSql.execute("use db") tdSql.execute("use db")
tdSql.query("show databases") tdSql.query("show databases")
...@@ -168,9 +168,10 @@ class TDTestCase: ...@@ -168,9 +168,10 @@ class TDTestCase:
tdSql.query("show stables") tdSql.query("show stables")
tdSql.checkRows(2) tdSql.checkRows(2)
os.system( os.system(
"%staosdump --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1" % binPath) "%s --databases db12312313231231321312312312_323 -o ./taosdumptest/tmp1" %
binPath)
tdSql.execute("drop database db12312313231231321312312312_323") tdSql.execute("drop database db12312313231231321312312312_323")
os.system("%staosdump -i ./taosdumptest/tmp1" % binPath) os.system("%s -i ./taosdumptest/tmp1" % binPath)
tdSql.execute("use db12312313231231321312312312_323") tdSql.execute("use db12312313231231321312312312_323")
tdSql.query("show stables") tdSql.query("show stables")
tdSql.checkRows(2) tdSql.checkRows(2)
......
...@@ -35,7 +35,7 @@ class TDTestCase: ...@@ -35,7 +35,7 @@ class TDTestCase:
else: else:
return True return True
def getBuildPath(self): def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
...@@ -43,13 +43,14 @@ class TDTestCase: ...@@ -43,13 +43,14 @@ class TDTestCase:
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ("taosdump" in files): if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")] paths.append(os.path.join(root, tool))
break break
return buildPath return paths[0]
def insert_data(self, tbname, ts_start, count): def insert_data(self, tbname, ts_start, count):
pre_insert = "insert into %s values" % tbname pre_insert = "insert into %s values" % tbname
...@@ -81,12 +82,11 @@ class TDTestCase: ...@@ -81,12 +82,11 @@ class TDTestCase:
os.system("rm -rf ./taosdumptest/tmp%d" % i) os.system("rm -rf ./taosdumptest/tmp%d" % i)
os.makedirs("./taosdumptest/tmp%d" % i) os.makedirs("./taosdumptest/tmp%d" % i)
buildPath = self.getBuildPath() binPath = self.getPath("taosdump")
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosdump not found!") tdLog.exit("taosdump not found!")
else: else:
tdLog.info("taosdump found in %s" % buildPath) tdLog.info("taosdump found: %s" % binPath)
binPath = buildPath + "/build/bin/"
# create db1 , one stables and one table ; create general tables # create db1 , one stables and one table ; create general tables
tdSql.execute("drop database if exists dp1") tdSql.execute("drop database if exists dp1")
...@@ -158,7 +158,7 @@ class TDTestCase: ...@@ -158,7 +158,7 @@ class TDTestCase:
2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, self.ts)) 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1, self.ts))
intData.append(i + 1) intData.append(i + 1)
floatData.append(i + 0.1) floatData.append(i + 0.1)
# os.system("%staosBenchmark -f tools/taosdump-insert-dp1.json -y " % binPath) # os.system("%staosBenchmark -f tools/taosdump-insert-dp1.json -y " % benchBinPath)
# create db1 , three stables:stb0,include ctables stb0_0 \ stb0_1,stb1 include ctables stb1_0 and stb1_1 # create db1 , three stables:stb0,include ctables stb0_0 \ stb0_1,stb1 include ctables stb1_0 and stb1_1
# \stb3,include ctables stb3_0 and stb3_1 # \stb3,include ctables stb3_0 and stb3_1
...@@ -200,22 +200,22 @@ class TDTestCase: ...@@ -200,22 +200,22 @@ class TDTestCase:
"insert into gt1 values(1614218413800,8638,78.862020199)") "insert into gt1 values(1614218413800,8638,78.862020199)")
tdSql.execute("insert into gt2 values(1614218413900,8639,78.863)") tdSql.execute("insert into gt2 values(1614218413900,8639,78.863)")
# self.insert_data("t", self.ts, 300*10000); # self.insert_data("t", self.ts, 300*10000);
# os.system("%staosBenchmark -f tools/taosdump-insert-dp2.json -y " % binPath) # os.system("%staosBenchmark -f tools/taosdump-insert-dp2.json -y " % benchBinPath)
# # taosdump data # # taosdump data
# os.system("%staosdump -o ./taosdumptest/tmp1 taosdump -h -ptaosdata -P 6030 -u root -o taosdumptest \ # os.system("%s -o ./taosdumptest/tmp1 taosdump -h -ptaosdata -P 6030 -u root -o taosdumptest \
# -D dp1,dp3 -N -c /home/chr/TDinternal/community/sim/dnode1/cfg/taos.cfg -s -d deflate" % binPath) # -D dp1,dp3 -N -c /home/chr/TDinternal/community/sim/dnode1/cfg/taos.cfg -s -d deflate" % binPath)
os.system( os.system(
"%staosdump -o ./taosdumptest/tmp0 -D dp2,dp1 -T 8" % "%s -o ./taosdumptest/tmp0 -D dp2,dp1 -T 8" %
binPath) binPath)
os.system( os.system(
"%staosdump -o ./taosdumptest/tmp1 dp2 st0 st1_0 gt0 -T 8" % "%s -o ./taosdumptest/tmp1 dp2 st0 st1_0 gt0 -T 8" %
binPath) binPath)
# check taosdumptest/tmp0 # check taosdumptest/tmp0
tdSql.execute("drop database dp1") tdSql.execute("drop database dp1")
tdSql.execute("drop database dp2") tdSql.execute("drop database dp2")
os.system("%staosdump -i ./taosdumptest/tmp0 -T 8 " % binPath) os.system("%s -i ./taosdumptest/tmp0 -T 8 " % binPath)
tdSql.execute("reset query cache") tdSql.execute("reset query cache")
tdSql.execute("use dp1") tdSql.execute("use dp1")
...@@ -265,7 +265,7 @@ class TDTestCase: ...@@ -265,7 +265,7 @@ class TDTestCase:
# check taosdumptest/tmp1 # check taosdumptest/tmp1
tdSql.execute("drop database dp1") tdSql.execute("drop database dp1")
tdSql.execute("drop database dp2") tdSql.execute("drop database dp2")
os.system("%staosdump -i ./taosdumptest/tmp1 -T 8 " % binPath) os.system("%s -i ./taosdumptest/tmp1 -T 8 " % binPath)
tdSql.execute("reset query cache") tdSql.execute("reset query cache")
tdSql.execute("use dp2") tdSql.execute("use dp2")
tdSql.query("show stables") tdSql.query("show stables")
...@@ -283,7 +283,7 @@ class TDTestCase: ...@@ -283,7 +283,7 @@ class TDTestCase:
# #check taosdumptest/tmp2 # #check taosdumptest/tmp2
# tdSql.execute("drop database dp1") # tdSql.execute("drop database dp1")
# tdSql.execute("drop database dp2") # tdSql.execute("drop database dp2")
# os.system("%staosdump -i ./taosdumptest/tmp2 -T 8 " % binPath) # os.system("%s -i ./taosdumptest/tmp2 -T 8 " % binPath)
# tdSql.execute("use dp1") # tdSql.execute("use dp1")
# tdSql.query("show stables") # tdSql.query("show stables")
# tdSql.checkRows(1) # tdSql.checkRows(1)
...@@ -301,7 +301,7 @@ class TDTestCase: ...@@ -301,7 +301,7 @@ class TDTestCase:
# #check taosdumptest/tmp3 # #check taosdumptest/tmp3
# tdSql.execute("drop database dp1") # tdSql.execute("drop database dp1")
# os.system("%staosdump -i ./taosdumptest/tmp3 -T 8 " % binPath) # os.system("%s -i ./taosdumptest/tmp3 -T 8 " % binPath)
# tdSql.execute("use dp2") # tdSql.execute("use dp2")
# tdSql.query("show stables") # tdSql.query("show stables")
# tdSql.checkRows(2) # tdSql.checkRows(2)
...@@ -317,7 +317,7 @@ class TDTestCase: ...@@ -317,7 +317,7 @@ class TDTestCase:
# #check taosdumptest/tmp4 # #check taosdumptest/tmp4
# tdSql.execute("drop database dp2") # tdSql.execute("drop database dp2")
# os.system("%staosdump -i ./taosdumptest/tmp4 -T 8 " % binPath) # os.system("%s -i ./taosdumptest/tmp4 -T 8 " % binPath)
# tdSql.execute("use dp2") # tdSql.execute("use dp2")
# tdSql.query("show stables") # tdSql.query("show stables")
# tdSql.checkRows(2) # tdSql.checkRows(2)
...@@ -340,7 +340,7 @@ class TDTestCase: ...@@ -340,7 +340,7 @@ class TDTestCase:
# #check taosdumptest/tmp5 # #check taosdumptest/tmp5
# tdSql.execute("drop database dp2") # tdSql.execute("drop database dp2")
# os.system("%staosdump -i ./taosdumptest/tmp5 -T 8 " % binPath) # os.system("%s -i ./taosdumptest/tmp5 -T 8 " % binPath)
# tdSql.execute("use dp2") # tdSql.execute("use dp2")
# tdSql.query("show stables") # tdSql.query("show stables")
# tdSql.checkRows(3) # tdSql.checkRows(3)
...@@ -377,7 +377,7 @@ class TDTestCase: ...@@ -377,7 +377,7 @@ class TDTestCase:
# tdSql.execute("drop database dp1") # tdSql.execute("drop database dp1")
# tdSql.execute("drop database dp2") # tdSql.execute("drop database dp2")
# tdSql.execute("drop database dp3") # tdSql.execute("drop database dp3")
# os.system("%staosdump -i ./taosdumptest/tmp6 -T 8 " % binPath) # os.system("%s -i ./taosdumptest/tmp6 -T 8 " % binPath)
# tdSql.execute("use dp3") # tdSql.execute("use dp3")
# tdSql.query("show databases") # tdSql.query("show databases")
# tdSql.checkRows(1) # tdSql.checkRows(1)
...@@ -394,7 +394,7 @@ class TDTestCase: ...@@ -394,7 +394,7 @@ class TDTestCase:
# # check taosdumptest/tmp7 # # check taosdumptest/tmp7
# tdSql.execute("drop database dp3") # tdSql.execute("drop database dp3")
# os.system("%staosdump -i ./taosdumptest/tmp7 -T 8 " % binPath) # os.system("%s -i ./taosdumptest/tmp7 -T 8 " % binPath)
# tdSql.execute("use dp3") # tdSql.execute("use dp3")
# tdSql.query("show databases") # tdSql.query("show databases")
# tdSql.checkRows(1) # tdSql.checkRows(1)
...@@ -411,7 +411,7 @@ class TDTestCase: ...@@ -411,7 +411,7 @@ class TDTestCase:
# # check taosdumptest/tmp8 # # check taosdumptest/tmp8
# tdSql.execute("drop database dp3") # tdSql.execute("drop database dp3")
# os.system("%staosdump -i ./taosdumptest/tmp8 -T 8 " % binPath) # os.system("%s -i ./taosdumptest/tmp8 -T 8 " % binPath)
# tdSql.execute("use dp3") # tdSql.execute("use dp3")
# tdSql.query("show stables") # tdSql.query("show stables")
# tdSql.checkRows(1) # tdSql.checkRows(1)
......
...@@ -35,7 +35,7 @@ class TDTestCase: ...@@ -35,7 +35,7 @@ class TDTestCase:
else: else:
return True return True
def getBuildPath(self): def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
...@@ -43,13 +43,14 @@ class TDTestCase: ...@@ -43,13 +43,14 @@ class TDTestCase:
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ("taosd" in files): if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")] paths.append(os.path.join(root, tool))
break break
return buildPath return paths[0]
def createdb(self, precision="ns"): def createdb(self, precision="ns"):
tb_nums = self.numberOfTables tb_nums = self.numberOfTables
...@@ -118,12 +119,11 @@ class TDTestCase: ...@@ -118,12 +119,11 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/dumptmp3"): if not os.path.exists("./taosdumptest/dumptmp3"):
os.makedirs("./taosdumptest/dumptmp3") os.makedirs("./taosdumptest/dumptmp3")
buildPath = self.getBuildPath() binPath = self.getPath("taosdump")
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosdump not found!") tdLog.exit("taosdump not found!")
else: else:
tdLog.info("taosdump found in %s" % buildPath) tdLog.info("taosdump found: %s" % binPath)
binPath = buildPath + "/build/bin/"
# create nano second database # create nano second database
...@@ -132,31 +132,31 @@ class TDTestCase: ...@@ -132,31 +132,31 @@ class TDTestCase:
# dump all data # dump all data
os.system( os.system(
"%staosdump --databases timedb1 -o ./taosdumptest/dumptmp1" % "%s --databases timedb1 -o ./taosdumptest/dumptmp1" %
binPath) binPath)
# dump part data with -S -E # dump part data with -S -E
os.system( os.system(
'%staosdump --databases timedb1 -S 1625068810000000000 -E 1625068860000000000 -o ./taosdumptest/dumptmp2 ' % '%s --databases timedb1 -S 1625068810000000000 -E 1625068860000000000 -o ./taosdumptest/dumptmp2 ' %
binPath) binPath)
os.system( os.system(
'%staosdump --databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 ' % '%s --databases timedb1 -S 1625068810000000000 -o ./taosdumptest/dumptmp3 ' %
binPath) binPath)
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath) os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st") tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 510) tdSql.checkData(0, 0, 510)
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath) os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st") tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 900) tdSql.checkData(0, 0, 900)
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath) os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st") tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 1000) tdSql.checkData(0, 0, 1000)
...@@ -164,7 +164,7 @@ class TDTestCase: ...@@ -164,7 +164,7 @@ class TDTestCase:
# check data # check data
origin_res = tdSql.getResult("select * from timedb1.st") origin_res = tdSql.getResult("select * from timedb1.st")
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath) os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
dump_res = tdSql.getResult("select * from timedb1.st") dump_res = tdSql.getResult("select * from timedb1.st")
if origin_res == dump_res: if origin_res == dump_res:
...@@ -178,7 +178,6 @@ class TDTestCase: ...@@ -178,7 +178,6 @@ class TDTestCase:
os.system("rm -rf ./taosdumptest/") os.system("rm -rf ./taosdumptest/")
tdSql.execute("drop database if exists timedb1") tdSql.execute("drop database if exists timedb1")
if not os.path.exists("./taosdumptest/tmp1"): if not os.path.exists("./taosdumptest/tmp1"):
os.makedirs("./taosdumptest/dumptmp1") os.makedirs("./taosdumptest/dumptmp1")
else: else:
...@@ -190,44 +189,43 @@ class TDTestCase: ...@@ -190,44 +189,43 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/dumptmp3"): if not os.path.exists("./taosdumptest/dumptmp3"):
os.makedirs("./taosdumptest/dumptmp3") os.makedirs("./taosdumptest/dumptmp3")
buildPath = self.getBuildPath() binPath = self.getPath()
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosdump not found!") tdLog.exit("taosdump not found!")
else: else:
tdLog.info("taosdump found in %s" % buildPath) tdLog.info("taosdump found: %s" % binPath)
binPath = buildPath + "/build/bin/"
self.createdb(precision="us") self.createdb(precision="us")
os.system( os.system(
"%staosdump --databases timedb1 -o ./taosdumptest/dumptmp1" % "%s --databases timedb1 -o ./taosdumptest/dumptmp1" %
binPath) binPath)
os.system( os.system(
'%staosdump --databases timedb1 -S 1625068810000000 -E 1625068860000000 -o ./taosdumptest/dumptmp2 ' % '%s --databases timedb1 -S 1625068810000000 -E 1625068860000000 -o ./taosdumptest/dumptmp2 ' %
binPath) binPath)
os.system( os.system(
'%staosdump --databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 ' % '%s --databases timedb1 -S 1625068810000000 -o ./taosdumptest/dumptmp3 ' %
binPath) binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath) os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath) os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath) os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath) os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st") tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 510) tdSql.checkData(0, 0, 510)
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath) os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st") tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 900) tdSql.checkData(0, 0, 900)
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath) os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st") tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 1000) tdSql.checkData(0, 0, 1000)
...@@ -235,7 +233,7 @@ class TDTestCase: ...@@ -235,7 +233,7 @@ class TDTestCase:
# check data # check data
origin_res = tdSql.getResult("select * from timedb1.st") origin_res = tdSql.getResult("select * from timedb1.st")
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath) os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
dump_res = tdSql.getResult("select * from timedb1.st") dump_res = tdSql.getResult("select * from timedb1.st")
if origin_res == dump_res: if origin_res == dump_res:
...@@ -260,44 +258,43 @@ class TDTestCase: ...@@ -260,44 +258,43 @@ class TDTestCase:
if not os.path.exists("./taosdumptest/dumptmp3"): if not os.path.exists("./taosdumptest/dumptmp3"):
os.makedirs("./taosdumptest/dumptmp3") os.makedirs("./taosdumptest/dumptmp3")
buildPath = self.getBuildPath() binPath = self.getPath()
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosdump not found!") tdLog.exit("taosdump not found!")
else: else:
tdLog.info("taosdump found in %s" % buildPath) tdLog.info("taosdump found: %s" % binPath)
binPath = buildPath + "/build/bin/"
self.createdb(precision="ms") self.createdb(precision="ms")
os.system( os.system(
"%staosdump --databases timedb1 -o ./taosdumptest/dumptmp1" % "%s --databases timedb1 -o ./taosdumptest/dumptmp1" %
binPath) binPath)
os.system( os.system(
'%staosdump --databases timedb1 -S 1625068810000 -E 1625068860000 -o ./taosdumptest/dumptmp2 ' % '%s --databases timedb1 -S 1625068810000 -E 1625068860000 -o ./taosdumptest/dumptmp2 ' %
binPath) binPath)
os.system( os.system(
'%staosdump --databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 ' % '%s --databases timedb1 -S 1625068810000 -o ./taosdumptest/dumptmp3 ' %
binPath) binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath) os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath) os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath) os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp2" % binPath) os.system("%s -i ./taosdumptest/dumptmp2" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st") tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 510) tdSql.checkData(0, 0, 510)
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp3" % binPath) os.system("%s -i ./taosdumptest/dumptmp3" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st") tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 900) tdSql.checkData(0, 0, 900)
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath) os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
tdSql.query("select count(*) from timedb1.st") tdSql.query("select count(*) from timedb1.st")
tdSql.checkData(0, 0, 1000) tdSql.checkData(0, 0, 1000)
...@@ -305,11 +302,12 @@ class TDTestCase: ...@@ -305,11 +302,12 @@ class TDTestCase:
# check data # check data
origin_res = tdSql.getResult("select * from timedb1.st") origin_res = tdSql.getResult("select * from timedb1.st")
tdSql.execute("drop database timedb1") tdSql.execute("drop database timedb1")
os.system("%staosdump -i ./taosdumptest/dumptmp1" % binPath) os.system("%s -i ./taosdumptest/dumptmp1" % binPath)
# dump data and check for taosdump # dump data and check for taosdump
dump_res = tdSql.getResult("select * from timedb1.st") dump_res = tdSql.getResult("select * from timedb1.st")
if origin_res == dump_res: if origin_res == dump_res:
tdLog.info("test million second : dump check data pass for all data!") tdLog.info(
"test million second : dump check data pass for all data!")
else: else:
tdLog.info( tdLog.info(
"test million second : dump check data failed for all data!") "test million second : dump check data failed for all data!")
......
...@@ -41,6 +41,7 @@ class TDSimClient: ...@@ -41,6 +41,7 @@ class TDSimClient:
"qdebugFlag": "135", "qdebugFlag": "135",
"telemetryReporting": "0", "telemetryReporting": "0",
} }
def init(self, path): def init(self, path):
self.__init__() self.__init__()
self.path = path self.path = path
...@@ -198,7 +199,7 @@ class TDDnode: ...@@ -198,7 +199,7 @@ class TDDnode:
"dnode:%d is deployed and configured by %s" % "dnode:%d is deployed and configured by %s" %
(self.index, self.cfgPath)) (self.index, self.cfgPath))
def getBuildPath(self): def getPath(self, tool="taosd"):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
...@@ -206,23 +207,22 @@ class TDDnode: ...@@ -206,23 +207,22 @@ class TDDnode:
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ("taosd" in files): if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")] paths.append(os.path.join(root, tool))
break break
return buildPath return paths[0]
def start(self): def start(self):
buildPath = self.getBuildPath() binPath = self.getPath()
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosd not found!") tdLog.exit("taosd not found!")
else: else:
tdLog.info("taosd found in %s" % buildPath) tdLog.info("taosd found: %s" % binPath)
binPath = buildPath + "/build/bin/taosd"
if self.deployed == 0: if self.deployed == 0:
tdLog.exit("dnode:%d is not deployed" % (self.index)) tdLog.exit("dnode:%d is not deployed" % (self.index))
......
...@@ -196,7 +196,7 @@ class TDDnode: ...@@ -196,7 +196,7 @@ class TDDnode:
"dnode:%d is deployed and configured by %s" % "dnode:%d is deployed and configured by %s" %
(self.index, self.cfgPath)) (self.index, self.cfgPath))
def getBuildPath(self): def getPath(self, tool="taosd"):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
...@@ -204,23 +204,22 @@ class TDDnode: ...@@ -204,23 +204,22 @@ class TDDnode:
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ("taosd" in files): if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")] paths.append(os.path.join(root, tool))
break break
return buildPath return paths[0]
def start(self): def start(self):
buildPath = self.getBuildPath() binPath = self.getPath()
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosd not found!") tdLog.exit("taosd not found!")
else: else:
tdLog.info("taosd found in %s" % buildPath) tdLog.info("taosd found: %s" % binPath)
binPath = buildPath + "/build/bin/taosd"
if self.deployed == 0: if self.deployed == 0:
tdLog.exit("dnode:%d is not deployed" % (self.index)) tdLog.exit("dnode:%d is not deployed" % (self.index))
......
...@@ -196,7 +196,7 @@ class TDDnode: ...@@ -196,7 +196,7 @@ class TDDnode:
"dnode:%d is deployed and configured by %s" % "dnode:%d is deployed and configured by %s" %
(self.index, self.cfgPath)) (self.index, self.cfgPath))
def getBuildPath(self): def getPath(self, tool="taosd"):
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
...@@ -204,23 +204,22 @@ class TDDnode: ...@@ -204,23 +204,22 @@ class TDDnode:
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ("taosd" in files): if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")] paths.append(os.path.join(root, tool))
break break
return buildPath return paths[0]
def start(self): def start(self):
buildPath = self.getBuildPath() binPath = self.getPath()
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosd not found!") tdLog.exit("taosd not found!")
else: else:
tdLog.info("taosd found in %s" % buildPath) tdLog.info("taosd found: %s" % binPath)
binPath = buildPath + "/build/bin/taosd"
if self.deployed == 0: if self.deployed == 0:
tdLog.exit("dnode:%d is not deployed" % (self.index)) tdLog.exit("dnode:%d is not deployed" % (self.index))
......
...@@ -65,9 +65,11 @@ class TDSimClient: ...@@ -65,9 +65,11 @@ class TDSimClient:
cmd = "echo %s %s >> %s" % (option, value, self.cfgPath) cmd = "echo %s %s >> %s" % (option, value, self.cfgPath)
if os.system(cmd) != 0: if os.system(cmd) != 0:
tdLog.exit(cmd) tdLog.exit(cmd)
def os_string(self,path):
os_path = path.replace("/",os.sep) def os_string(self, path):
os_path = path.replace("/", os.sep)
return os_path return os_path
def deploy(self): def deploy(self):
self.logDir = self.os_string("%s/sim/psim/log" % (self.path)) self.logDir = self.os_string("%s/sim/psim/log" % (self.path))
self.cfgDir = self.os_string("%s/sim/psim/cfg" % (self.path)) self.cfgDir = self.os_string("%s/sim/psim/cfg" % (self.path))
...@@ -79,8 +81,8 @@ class TDSimClient: ...@@ -79,8 +81,8 @@ class TDSimClient:
if os.path.exists(self.logDir): if os.path.exists(self.logDir):
try: try:
shutil.rmtree(self.logDir) shutil.rmtree(self.logDir)
except: except BaseException:
tdLog.exit("del %s failed"%self.logDir) tdLog.exit("del %s failed" % self.logDir)
# cmd = "mkdir -p " + self.logDir # cmd = "mkdir -p " + self.logDir
# if os.system(cmd) != 0: # if os.system(cmd) != 0:
# tdLog.exit(cmd) # tdLog.exit(cmd)
...@@ -91,8 +93,8 @@ class TDSimClient: ...@@ -91,8 +93,8 @@ class TDSimClient:
if os.path.exists(self.cfgDir): if os.path.exists(self.cfgDir):
try: try:
shutil.rmtree(self.cfgDir) shutil.rmtree(self.cfgDir)
except: except BaseException:
tdLog.exit("del %s failed"%self.cfgDir) tdLog.exit("del %s failed" % self.cfgDir)
# cmd = "mkdir -p " + self.cfgDir # cmd = "mkdir -p " + self.cfgDir
# if os.system(cmd) != 0: # if os.system(cmd) != 0:
# tdLog.exit(cmd) # tdLog.exit(cmd)
...@@ -102,8 +104,8 @@ class TDSimClient: ...@@ -102,8 +104,8 @@ class TDSimClient:
# tdLog.exit(cmd) # tdLog.exit(cmd)
try: try:
pathlib.Path(self.cfgPath).touch() pathlib.Path(self.cfgPath).touch()
except: except BaseException:
tdLog.exit("create %s failed"%self.cfgPath) tdLog.exit("create %s failed" % self.cfgPath)
if self.testCluster: if self.testCluster:
self.cfg("masterIp", "192.168.0.1") self.cfg("masterIp", "192.168.0.1")
self.cfg("secondIp", "192.168.0.2") self.cfg("secondIp", "192.168.0.2")
...@@ -123,36 +125,36 @@ class TDDnode: ...@@ -123,36 +125,36 @@ class TDDnode:
self.testCluster = False self.testCluster = False
self.valgrind = 0 self.valgrind = 0
self.cfgDict = { self.cfgDict = {
"numOfLogLines":"100000000", "numOfLogLines": "100000000",
"mnodeEqualVnodeNum":"0", "mnodeEqualVnodeNum": "0",
"walLevel":"2", "walLevel": "2",
"fsync":"1000", "fsync": "1000",
"statusInterval":"1", "statusInterval": "1",
"numOfMnodes":"3", "numOfMnodes": "3",
"numOfThreadsPerCore":"2.0", "numOfThreadsPerCore": "2.0",
"monitor":"0", "monitor": "0",
"maxVnodeConnections":"30000", "maxVnodeConnections": "30000",
"maxMgmtConnections":"30000", "maxMgmtConnections": "30000",
"maxMeterConnections":"30000", "maxMeterConnections": "30000",
"maxShellConns":"30000", "maxShellConns": "30000",
"locale":"en_US.UTF-8", "locale": "en_US.UTF-8",
"charset":"UTF-8", "charset": "UTF-8",
"asyncLog":"0", "asyncLog": "0",
"anyIp":"0", "anyIp": "0",
"telemetryReporting":"0", "telemetryReporting": "0",
"dDebugFlag":"135", "dDebugFlag": "135",
"tsdbDebugFlag":"135", "tsdbDebugFlag": "135",
"mDebugFlag":"135", "mDebugFlag": "135",
"sdbDebugFlag":"135", "sdbDebugFlag": "135",
"rpcDebugFlag":"135", "rpcDebugFlag": "135",
"tmrDebugFlag":"131", "tmrDebugFlag": "131",
"cDebugFlag":"135", "cDebugFlag": "135",
"httpDebugFlag":"135", "httpDebugFlag": "135",
"monitorDebugFlag":"135", "monitorDebugFlag": "135",
"udebugFlag":"135", "udebugFlag": "135",
"jnidebugFlag":"135", "jnidebugFlag": "135",
"qdebugFlag":"135", "qdebugFlag": "135",
"maxSQLLength":"1048576", "maxSQLLength": "1048576",
"enableCoreFile": "1", "enableCoreFile": "1",
} }
...@@ -227,16 +229,16 @@ class TDDnode: ...@@ -227,16 +229,16 @@ class TDDnode:
isFirstDir = 1 isFirstDir = 1
if bool(updatecfgDict) and updatecfgDict[0] and updatecfgDict[0][0]: if bool(updatecfgDict) and updatecfgDict[0] and updatecfgDict[0][0]:
print(updatecfgDict[0][0]) print(updatecfgDict[0][0])
for key,value in updatecfgDict[0][0].items(): for key, value in updatecfgDict[0][0].items():
if value == 'dataDir' : if value == 'dataDir':
if isFirstDir: if isFirstDir:
self.cfgDict.pop('dataDir') self.cfgDict.pop('dataDir')
self.cfg(value,key) self.cfg(value, key)
isFirstDir = 0 isFirstDir = 0
else: else:
self.cfg(value,key) self.cfg(value, key)
else: else:
self.addExtraCfg(key,value) self.addExtraCfg(key, value)
for key, value in self.cfgDict.items(): for key, value in self.cfgDict.items():
self.cfg(key, value) self.cfg(key, value)
...@@ -245,8 +247,7 @@ class TDDnode: ...@@ -245,8 +247,7 @@ class TDDnode:
"dnode:%d is deployed and configured by %s" % "dnode:%d is deployed and configured by %s" %
(self.index, self.cfgPath)) (self.index, self.cfgPath))
def getBuildPath(self, tool="taosd"): def getPath(self, tool="taosd"):
buildPath = ""
selfPath = os.path.dirname(os.path.realpath(__file__)) selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath): if ("community" in selfPath):
...@@ -254,24 +255,28 @@ class TDDnode: ...@@ -254,24 +255,28 @@ class TDDnode:
else: else:
projPath = selfPath[:selfPath.find("tests")] projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
if ((tool) in files): if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")] paths.append(os.path.join(root, tool))
break break
return buildPath return paths[0]
def start(self): def start(self):
buildPath = self.getBuildPath() binPath = self.getPath()
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosd not found!") tdLog.exit("taosd not found!")
else: else:
tdLog.info("taosd found in %s" % buildPath) tdLog.info("taosd found: %s" % binPath)
binPath = buildPath + "/build/bin/taosd" taosadapterBinPath = self.getPath("taosadapter")
taosadapterBinPath = buildPath + "/build/bin/taosadapter" if (taosadapterBinPath == ""):
tdLog.exit("taosAdapter not found!")
else:
tdLog.info("taosAdapter found: %s" % taosadapterBinPath)
if self.deployed == 0: if self.deployed == 0:
tdLog.exit("dnode:%d is not deployed" % (self.index)) tdLog.exit("dnode:%d is not deployed" % (self.index))
...@@ -301,18 +306,22 @@ class TDDnode: ...@@ -301,18 +306,22 @@ class TDDnode:
if self.valgrind == 0: if self.valgrind == 0:
time.sleep(0.1) time.sleep(0.1)
key = 'from offline to online' key = 'from offline to online'
bkey = bytes(key,encoding="utf8") bkey = bytes(key, encoding="utf8")
logFile = self.logDir + "/taosdlog.0" logFile = self.logDir + "/taosdlog.0"
i = 0 i = 0
while not os.path.exists(logFile): while not os.path.exists(logFile):
sleep(0.1) sleep(0.1)
i += 1 i += 1
if i>50: if i > 50:
break break
popen = subprocess.Popen('tail -f ' + logFile, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) popen = subprocess.Popen(
'tail -f ' + logFile,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
pid = popen.pid pid = popen.pid
# print('Popen.pid:' + str(pid)) # print('Popen.pid:' + str(pid))
timeout = time.time() + 60*2 timeout = time.time() + 60 * 2
while True: while True:
line = popen.stdout.readline().strip() line = popen.stdout.readline().strip()
if bkey in line: if bkey in line:
...@@ -322,21 +331,26 @@ class TDDnode: ...@@ -322,21 +331,26 @@ class TDDnode:
tdLog.exit('wait too long for taosd start') tdLog.exit('wait too long for taosd start')
tdLog.debug("the dnode:%d has been started." % (self.index)) tdLog.debug("the dnode:%d has been started." % (self.index))
else: else:
tdLog.debug("wait 10 seconds for the dnode:%d to start." % (self.index)) tdLog.debug(
"wait 10 seconds for the dnode:%d to start." %
(self.index))
time.sleep(10) time.sleep(10)
# time.sleep(5) # time.sleep(5)
def startWin(self): def startWin(self):
buildPath = self.getBuildPath("taosd.exe") binPath = self.getPath("taosd.exe")
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosd.exe not found!") tdLog.exit("taosd.exe not found!")
else: else:
tdLog.info("taosd.exe found in %s" % buildPath) tdLog.info("taosd.exe found: %s" % bnPath)
binPath = buildPath + "/build/bin/taosd.exe" taosadapterBinPath = self.getPath("taosadapter.exe")
taosadapterBinPath = buildPath + "/build/bin/taosadapter.exe" if (taosadapterBinPath == ""):
tdLog.exit("taosAdapter.exe not found!")
else:
tdLog.info("taosAdapter.exe found in %s" % taosadapterBuildPath)
if self.deployed == 0: if self.deployed == 0:
tdLog.exit("dnode:%d is not deployed" % (self.index)) tdLog.exit("dnode:%d is not deployed" % (self.index))
...@@ -357,18 +371,22 @@ class TDDnode: ...@@ -357,18 +371,22 @@ class TDDnode:
if self.valgrind == 0: if self.valgrind == 0:
time.sleep(0.1) time.sleep(0.1)
key = 'from offline to online' key = 'from offline to online'
bkey = bytes(key,encoding="utf8") bkey = bytes(key, encoding="utf8")
logFile = self.logDir + "/taosdlog.0" logFile = self.logDir + "/taosdlog.0"
i = 0 i = 0
while not os.path.exists(logFile): while not os.path.exists(logFile):
sleep(0.1) sleep(0.1)
i += 1 i += 1
if i>50: if i > 50:
break break
popen = subprocess.Popen('tail -n +0 -f ' + logFile, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) popen = subprocess.Popen(
'tail -n +0 -f ' + logFile,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
pid = popen.pid pid = popen.pid
# print('Popen.pid:' + str(pid)) # print('Popen.pid:' + str(pid))
timeout = time.time() + 60*2 timeout = time.time() + 60 * 2
while True: while True:
line = popen.stdout.readline().strip() line = popen.stdout.readline().strip()
if bkey in line: if bkey in line:
...@@ -378,19 +396,24 @@ class TDDnode: ...@@ -378,19 +396,24 @@ class TDDnode:
tdLog.exit('wait too long for taosd start') tdLog.exit('wait too long for taosd start')
tdLog.debug("the dnode:%d has been started." % (self.index)) tdLog.debug("the dnode:%d has been started." % (self.index))
else: else:
tdLog.debug("wait 10 seconds for the dnode:%d to start." % (self.index)) tdLog.debug(
"wait 10 seconds for the dnode:%d to start." %
(self.index))
time.sleep(10) time.sleep(10)
def startWithoutSleep(self): def startWithoutSleep(self):
buildPath = self.getBuildPath() binPath = self.getPath()
if (buildPath == ""): if (binPath == ""):
tdLog.exit("taosd not found!") tdLog.exit("taosd not found!")
else: else:
tdLog.info("taosd found in %s" % buildPath) tdLog.info("taosd found: %s" % binPath)
binPath = buildPath + "/build/bin/taosd" taosadapterBinPath = self.getPath("taosadapter")
taosadapterBinPath = buildPath + "/build/bin/taosadapter" if (taosadapterBinPath == ""):
tdLog.exit("taosAdapter not found!")
else:
tdLog.info("taosAdapter found: %s" % taosadapterBinPath)
if self.deployed == 0: if self.deployed == 0:
tdLog.exit("dnode:%d is not deployed" % (self.index)) tdLog.exit("dnode:%d is not deployed" % (self.index))
......
...@@ -36,20 +36,21 @@ class TDTestCase: ...@@ -36,20 +36,21 @@ class TDTestCase:
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
tools = ["taosdump", "taosBenchmark", "taosAdaptor"] tools = ["taosdump", "taosBenchmark", "taosadapter"]
tdDnodes.stop(1) tdDnodes.stop(1)
for tool in tools: for tool in tools:
path = tdDnodes.dnodes[1].getBuildPath(tool) path = tdDnodes.dnodes[1].getPath(tool)
try: try:
path += "/build/bin/"
print(f"{path}{tool}") print(f"{path}{tool}")
if tool == "taosBenchmark": if tool == "taosBenchmark":
os.system(f"{path}{tool} -y") os.system(f"{path}{tool} -y")
elif tool == "taosadapter":
os.system(f"pkill -9 {tool}")
else: else:
os.system(f"{path}{tool}") os.system(f"{path}{tool}")
except: except BaseException:
pass pass
def stop(self): def stop(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册