Skip to content

Commit

Permalink
feat: update taostools 7d5c1c0 for develop (taosdata#16710)
Browse files Browse the repository at this point in the history
* feat: update taos-tools f169c0f for develop

* feat: update taos-tools a4d9b92 for develop

* feat: update taos-tools 7d5c1c0 for develop

* fix: after taosbenchmark create table without if not exits
  • Loading branch information
sangshuduo authored Sep 7, 2022
1 parent 3c73fbe commit a9c0051
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 79 deletions.
2 changes: 1 addition & 1 deletion src/kit/taos-tools
Submodule taos-tools updated 101 files
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,43 @@ def init(self, conn, logSql):
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
if "community" in selfPath:
projPath = selfPath[: selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
projPath = selfPath[: selfPath.find("tests")]

for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
if "taosd" in files:
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")]
if "packaging" not in rootRealPath:
buildPath = root[: len(root) - len("/build/bin")]
break
return buildPath

def run(self):
buildPath = self.getBuildPath()
if (buildPath == ""):
if buildPath == "":
tdLog.exit("taosd not found!")
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath+ "/build/bin/"
binPath = buildPath + "/build/bin/"

testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf ./insert*_res.txt*")
os.system("rm -rf 5-taos-tools/taosbenchmark/%s.sql" % testcaseFilename )
os.system("rm -rf 5-taos-tools/taosbenchmark/%s.sql" % testcaseFilename)

# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-nodbnodrop.json -y" % binPath)
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-nodbnodrop.json -y"
% binPath
)
tdSql.error("show dbno.stables")
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-newdb.json -y" % binPath)
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-newdb.json -y"
% binPath
)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 5)
Expand All @@ -69,7 +75,10 @@ def run(self):
tdSql.checkData(0, 0, 8)
tdSql.query("select count (tbname) from stb4")
tdSql.checkData(0, 0, 8)
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-offset.json -y" % binPath)
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-offset.json -y"
% binPath
)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 50)
Expand All @@ -81,19 +90,25 @@ def run(self):
tdSql.checkData(0, 0, 180)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 160)
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-newtable.json -y" % binPath)
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-newtable.json -y"
% binPath
)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 150)
tdSql.checkData(0, 0, 50)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 360)
tdSql.checkData(0, 0, 240)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 360)
tdSql.checkData(0, 0, 220)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 340)
tdSql.checkData(0, 0, 180)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 400)
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-renewdb.json -y" % binPath)
tdSql.checkData(0, 0, 160)
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/insert-renewdb.json -y"
% binPath
)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 50)
Expand All @@ -105,15 +120,10 @@ def run(self):
tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 160)

# rm useless files
os.system("rm -rf ./insert*_res.txt*")






def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,36 @@ class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)

def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))

if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
if "community" in selfPath:
projPath = selfPath[: selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
projPath = selfPath[: selfPath.find("tests")]

for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
if "taosd" in files:
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root)-len("/build/bin")]
if "packaging" not in rootRealPath:
buildPath = root[: len(root) - len("/build/bin")]
break
return buildPath

def run(self):
buildPath = self.getBuildPath()
if (buildPath == ""):
if buildPath == "":
tdLog.exit("taosd not found!")
else:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath+ "/build/bin/"
binPath = buildPath + "/build/bin/"

# insert: create one or mutiple tables per sql and insert multiple rows per sql
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-1s1tnt1r-stmt.json -y " % binPath)
# insert: create one or mutiple tables per sql and insert multiple rows per sql
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-1s1tnt1r-stmt.json -y "
% binPath
)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 10)
Expand All @@ -62,50 +65,61 @@ def run(self):
tdSql.query("select count(*) from stb01_1")
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 4000)
tdSql.checkData(0, 0, 4000)


# insert: create mutiple tables per sql and insert one rows per sql .
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-1s1tntmr-stmt.json -y " % binPath)
# insert: create mutiple tables per sql and insert one rows per sql .
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-1s1tntmr-stmt.json -y "
% binPath
)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 20)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 100)
tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 1000)
tdSql.checkData(0, 0, 1000)
tdSql.query("select count(*) from stb01_0")
tdSql.checkData(0, 0, 200)
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 4000)
tdSql.checkData(0, 0, 4000)

# insert: using parament "insert_interval to controls spped of insert.
# insert: using parament "insert_interval to controls spped of insert.
# but We need to have accurate methods to control the speed, such as getting the speed value, checking the count and so on。
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-interval-speed-stmt.json -y" % binPath)
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-interval-speed-stmt.json -y"
% binPath
)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 10)
tdSql.query("select count (tbname) from stb1")
tdSql.checkData(0, 0, 20)
tdSql.query("select count(*) from stb00_0")
tdSql.checkData(0, 0, 100)
tdSql.checkData(0, 0, 100)
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 1000)
tdSql.checkData(0, 0, 1000)
tdSql.query("show stables")
tdSql.checkData(1, 4, 20)
tdSql.query("select count(*) from stb01_0")
tdSql.checkData(0, 0, 200)
tdSql.checkData(0, 0, 200)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 4000)
tdSql.checkData(0, 0, 4000)

# spend 2min30s for 3 testcases.
# insert: drop and child_table_exists combination test
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-nodbnodrop-stmt.json -y" % binPath)
# insert: using parament "childtable_offset and childtable_limit" to control table'offset point and offset
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-nodbnodrop-stmt.json -y"
% binPath
)
tdSql.error("show dbno.stables")
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-newdb-stmt.json -y" % binPath)
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-newdb-stmt.json -y"
% binPath
)
tdSql.execute("use db")
tdSql.query("select count (tbname) from stb0")
tdSql.checkData(0, 0, 5)
Expand All @@ -114,52 +128,59 @@ def run(self):
tdSql.query("select count (tbname) from stb2")
tdSql.checkData(0, 0, 7)
tdSql.query("select count (tbname) from stb3")
tdSql.checkData(0, 0, 8)
tdSql.checkData(0, 0, 8)
tdSql.query("select count (tbname) from stb4")
tdSql.checkData(0, 0, 8)
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-offset-stmt.json -y" % binPath)
tdSql.execute("use db")
tdSql.checkData(0, 0, 8)
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-offset-stmt.json -y"
% binPath
)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 50)
tdSql.checkData(0, 0, 50)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 240)
tdSql.checkData(0, 0, 240)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 220)
tdSql.checkData(0, 0, 220)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 180)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 160)
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-newtable-stmt.json -y" % binPath)
tdSql.execute("use db")
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-newtable-stmt.json -y"
% binPath
)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 150)
tdSql.checkData(0, 0, 50)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 360)
tdSql.checkData(0, 0, 240)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 360)
tdSql.checkData(0, 0, 220)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 340)
tdSql.checkData(0, 0, 180)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 400)
os.system("%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-renewdb-stmt.json -y" % binPath)
tdSql.execute("use db")
tdSql.checkData(0, 0, 160)
os.system(
"%staosBenchmark -f 5-taos-tools/taosbenchmark/stmt/insert-renewdb-stmt.json -y"
% binPath
)
tdSql.execute("use db")
tdSql.query("select count(*) from stb0")
tdSql.checkData(0, 0, 50)
tdSql.checkData(0, 0, 50)
tdSql.query("select count(*) from stb1")
tdSql.checkData(0, 0, 120)
tdSql.checkData(0, 0, 120)
tdSql.query("select count(*) from stb2")
tdSql.checkData(0, 0, 140)
tdSql.checkData(0, 0, 140)
tdSql.query("select count(*) from stb3")
tdSql.checkData(0, 0, 160)
tdSql.query("select count(*) from stb4")
tdSql.checkData(0, 0, 160)

testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf ./insert_res.txt")
os.system("rm -rf 5-taos-tools/taosbenchmark/%s.sql" % testcaseFilename )



os.system("rm -rf 5-taos-tools/taosbenchmark/%s.sql" % testcaseFilename)

def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
Expand Down

0 comments on commit a9c0051

Please sign in to comment.