From b3a4bf11c366c08697bc6856b0538bf67f1281fc Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 7 Sep 2022 13:33:30 +0800 Subject: [PATCH] feat: update taostools 7d5c1c0 for2.6 (#16711) * feat: update taos-tools f169c0f for 2.6 * feat: update taos-tools a4d9b92 for 2.6 * feat: update taos-tools 7d5c1c0 for 2.6 * fix: 5-taos-tools/taosbenchmark/taosdemoTestInsertWithJson-childTable.py after, create table without if not exits * fix: 5-taos-tools/taosbenchmark/taosdemoTestInsertWithJsonStmt.py after, create table without if not exits --- src/kit/taos-tools | 2 +- .../taosdemoTestInsertWithJson-childTable.py | 60 +++++---- .../taosdemoTestInsertWithJsonStmt.py | 127 ++++++++++-------- 3 files changed, 110 insertions(+), 79 deletions(-) diff --git a/src/kit/taos-tools b/src/kit/taos-tools index a4d9b9229a..7d5c1c016d 160000 --- a/src/kit/taos-tools +++ b/src/kit/taos-tools @@ -1 +1 @@ -Subproject commit a4d9b9229a7243a1c337ee6e34ee369a2f942dfb +Subproject commit 7d5c1c016d2022d152a6aaa38589f2fbaa0d25a4 diff --git a/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJson-childTable.py b/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJson-childTable.py index 56d402baa1..1729f4201c 100644 --- a/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJson-childTable.py +++ b/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJson-childTable.py @@ -27,37 +27,43 @@ class TDTestCase: 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) @@ -69,7 +75,10 @@ class TDTestCase: 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) @@ -81,19 +90,25 @@ class TDTestCase: 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) @@ -105,15 +120,10 @@ class TDTestCase: 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__) diff --git a/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJsonStmt.py b/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJsonStmt.py index d470dee214..885d580a9e 100644 --- a/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJsonStmt.py +++ b/tests/system-test/5-taos-tools/taosbenchmark/taosdemoTestInsertWithJsonStmt.py @@ -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) @@ -62,50 +65,61 @@ class TDTestCase: 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) @@ -114,41 +128,50 @@ class TDTestCase: 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") @@ -156,10 +179,8 @@ class TDTestCase: 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__) -- GitLab