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

test: refine taosdumptestbasic.py by refurb/black (#17202)

* fix: taosbenchmark stmt + csv rework for develop

* fix: update taos-tools 85179e9

* test: fix default_json.py to align with doc

* test: refine taosdumpTestBasic.py by refurb/black
上级 f8a1d27d
...@@ -20,10 +20,9 @@ from util.dnodes import * ...@@ -20,10 +20,9 @@ from util.dnodes import *
class TDTestCase: class TDTestCase:
def caseDescription(self): def caseDescription(self):
''' """
case1<sdsang>: [TD-18291] taosdump basic test case1<sdsang>: [TD-18291] taosdump basic test
''' """
return
def init(self, conn, logSql): def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
...@@ -33,23 +32,23 @@ class TDTestCase: ...@@ -33,23 +32,23 @@ class TDTestCase:
def getPath(self, tool="taosdump"): 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:
projPath = selfPath[:selfPath.find("community")] projPath = selfPath[: selfPath.find("community")]
elif ("src" in selfPath): elif "src" in selfPath:
projPath = selfPath[:selfPath.find("src")] projPath = selfPath[: selfPath.find("src")]
elif ("/tools/" in selfPath): elif "/tools/" in selfPath:
projPath = selfPath[:selfPath.find("/tools/")] projPath = selfPath[: selfPath.find("/tools/")]
else: else:
tdLog.exit("path: %s is not supported" % selfPath) tdLog.exit("path: %s is not supported" % selfPath)
paths = [] 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:
paths.append(os.path.join(root, tool)) paths.append(os.path.join(root, tool))
break break
if (len(paths) == 0): if len(paths) == 0:
return "" return ""
return paths[0] return paths[0]
...@@ -61,26 +60,34 @@ class TDTestCase: ...@@ -61,26 +60,34 @@ class TDTestCase:
tdSql.execute("use db") tdSql.execute("use db")
tdSql.execute( tdSql.execute(
"create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)") "create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)"
)
tdSql.execute( tdSql.execute(
"create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)") "create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql.execute( tdSql.execute(
"insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)") "insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql.execute( tdSql.execute(
"create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)") "create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
tdSql.execute( tdSql.execute(
"insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)") "insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
tdSql.execute( tdSql.execute(
"create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)") "create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)"
)
tdSql.execute( tdSql.execute(
"insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)") "insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql.execute( tdSql.execute(
"insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)") "insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
# sys.exit(1) # sys.exit(1)
binPath = self.getPath("taosdump") binPath = self.getPath()
if (binPath == ""): if binPath == "":
tdLog.exit("taosdump not found!") tdLog.exit("taosdump not found!")
else: else:
tdLog.info("taosdump found in %s" % binPath) tdLog.info("taosdump found in %s" % binPath)
...@@ -92,12 +99,10 @@ class TDTestCase: ...@@ -92,12 +99,10 @@ class TDTestCase:
os.system("rm -rf %s" % self.tmpdir) os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir) os.makedirs(self.tmpdir)
os.system( os.system("%s -D db -o %s -T 1" % (binPath, self.tmpdir))
"%s -D db -o %s -T 1" %
(binPath, self.tmpdir))
tdSql.execute("drop database db") tdSql.execute("drop database db")
# sys.exit(1) # sys.exit(1)
os.system("%s -i %s -T 1" % (binPath, self.tmpdir)) os.system("%s -i %s -T 1" % (binPath, self.tmpdir))
...@@ -107,7 +112,7 @@ class TDTestCase: ...@@ -107,7 +112,7 @@ class TDTestCase:
found = False found = False
for i in range(len(dbresult)): for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0]) print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"): if dbresult[i][0] == "db":
found = True found = True
break break
...@@ -116,12 +121,11 @@ class TDTestCase: ...@@ -116,12 +121,11 @@ class TDTestCase:
tdSql.execute("use db") tdSql.execute("use db")
tdSql.query("show stables") tdSql.query("show stables")
tdSql.checkRows(1) tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st') tdSql.checkData(0, 0, "st")
tdSql.query("show tables") tdSql.query("show tables")
tdSql.checkRows(3) tdSql.checkRows(3)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册