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

feat: update taostools 2.2.0 (2dba49c) for2.6 (#16773)

* 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

* feat: update taos-tools 2.2.0 (2dba49c) for 2.6

* feat: update test cases
上级 a55dcf3e
Subproject commit 7d5c1c016d2022d152a6aaa38589f2fbaa0d25a4
Subproject commit 2dba49cf57cde998f768bb033619b4d8c5143127
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-18291] taosdump basic test
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
tdLog.exit("path: %s is not supported" % selfPath)
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
return ""
return paths[0]
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
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)")
tdSql.execute(
"create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)")
tdSql.execute(
"insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)")
tdSql.execute(
"create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)")
tdSql.execute(
"insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)")
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)")
tdSql.execute(
"insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)")
tdSql.execute(
"insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)")
# sys.exit(1)
binPath = self.getPath("taosdump")
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % binPath)
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%s db t1 -o %s -T 1" %
(binPath, self.tmpdir))
tdSql.execute("drop database db")
# sys.exit(1)
os.system("%s -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(1)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-18291] taosdump basic test
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
tdLog.exit("path: %s is not supported" % selfPath)
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
return ""
return paths[0]
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
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)")
tdSql.execute(
"create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)")
tdSql.execute(
"insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)")
tdSql.execute(
"create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)")
tdSql.execute(
"insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)")
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)")
tdSql.execute(
"insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)")
tdSql.execute(
"insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)")
# sys.exit(1)
binPath = self.getPath("taosdump")
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % binPath)
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%s db st -o %s -T 1" %
(binPath, self.tmpdir))
tdSql.execute("drop database db")
# sys.exit(1)
os.system("%s -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(2)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TS-1762] taosdump with many columns
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
tdLog.exit("path: %s is not supported" % selfPath)
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
return ""
return paths[0]
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
stb_sql = "create stable stb(ts timestamp"
for index in range(4095-128):
stb_sql += (", col%d INT" % (index+1))
stb_sql += ") tags(tag0 INT"
for index in range(127):
stb_sql += (", tag%d INT" % (index+1))
stb_sql += ")"
tdSql.execute(stb_sql);
# sys.exit(1)
tb_sql = "create table tb using stb tags(0"
for index in range(127):
tb_sql += (",%d" % (index+1))
tb_sql += ")"
tdSql.execute(tb_sql);
# sys.exit(1)
for record in range(100):
ins_sql = ("insert into tb values(%d" % (1640000000000+record))
for index in range(4095-128):
ins_sql += (",%d" % index)
ins_sql += ")"
tdSql.execute(ins_sql);
binPath = self.getPath("taosdump")
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % binPath)
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%s db -o %s -T 1" %
(binPath, self.tmpdir))
tdSql.execute("drop database db")
# sys.exit(1)
os.system("%s -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'stb')
tdSql.query("show tables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'tb')
tdSql.query("select count(*) from db.stb")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 100)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def caseDescription(self):
'''
case1<sdsang>: [TD-18291] taosdump basic test
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
tdLog.exit("path: %s is not supported" % selfPath)
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
if (len(paths) == 0):
return ""
return paths[0]
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
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)")
tdSql.execute(
"create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)")
tdSql.execute(
"insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)")
tdSql.execute(
"create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)")
tdSql.execute(
"insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)")
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)")
tdSql.execute(
"insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)")
tdSql.execute(
"insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)")
# sys.exit(1)
binPath = self.getPath("taosdump")
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % binPath)
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
else:
print("directory exists")
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%s -D db -o %s -T 1" %
(binPath, self.tmpdir))
tdSql.execute("drop database db")
# sys.exit(1)
os.system("%s -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'st')
tdSql.query("show tables")
tdSql.checkRows(3)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -11,20 +11,18 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def caseDescription(self):
'''
"""
case1<sdsang>: [TD-14544] taosdump data inspect
'''
"""
return
def init(self, conn, logSql):
......@@ -35,19 +33,23 @@ class TDTestCase:
def getPath(self, tool="taosdump"):
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")]
elif "src" in selfPath:
projPath = selfPath[: selfPath.find("src")]
elif "/tools/" in selfPath:
projPath = selfPath[: selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
if (tool) in files:
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))
break
if (len(paths) == 0):
if len(paths) == 0:
return ""
return paths[0]
......@@ -55,24 +57,29 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
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(
"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(
"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(
"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(
"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)"
)
# sys.exit(1)
# sys.exit(1)
binPath = self.getPath("taosdump")
if (binPath == ""):
if binPath == "":
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % binPath)
......@@ -84,35 +91,73 @@ class TDTestCase:
os.system("rm -rf %s" % self.tmpdir)
os.makedirs(self.tmpdir)
os.system(
"%s --databases db -o %s -T 1" %
(binPath, self.tmpdir))
os.system("%s --databases db -o %s -T 1" % (binPath, self.tmpdir))
# sys.exit(1)
# sys.exit(1)
taosdumpInspectCmd = "%s -I %s/*.avro* -s | grep 'Schema:'|wc -l" % (
binPath, self.tmpdir)
schemaTimes = subprocess.check_output(
taosdumpInspectCmd, shell=True).decode("utf-8")
taosdumpInspectCmd = "%s -I %s/taosdump.*/*.avro* -s | grep 'Schema:'|wc -l" % (
binPath,
self.tmpdir,
)
schemaTimes = subprocess.check_output(taosdumpInspectCmd, shell=True).decode(
"utf-8"
)
print("schema found times: %d" % int(schemaTimes))
if (int(schemaTimes) != 3):
if int(schemaTimes) != 1:
caller = inspect.getframeinfo(inspect.stack()[0][0])
tdLog.exit(
"%s(%d) failed: expected schema found times 3, actual %d" %
(caller.filename, caller.lineno, int(schemaTimes)))
"%s(%d) failed: expected schema found times 1, actual %d"
% (caller.filename, caller.lineno, int(schemaTimes))
)
taosdumpInspectCmd = (
"%s -I %s/taosdump*/data*/*.avro* -s | grep 'Schema:'|wc -l"
% (binPath, self.tmpdir)
)
schemaTimes = subprocess.check_output(taosdumpInspectCmd, shell=True).decode(
"utf-8"
)
print("schema found times: %d" % int(schemaTimes))
taosdumpInspectCmd = "%s -I %s/*.avro* | grep '=== Records:'|wc -l" % (
binPath, self.tmpdir)
recordsTimes = subprocess.check_output(
taosdumpInspectCmd, shell=True).decode("utf-8")
if int(schemaTimes) != 2:
caller = inspect.getframeinfo(inspect.stack()[0][0])
tdLog.exit(
"%s(%d) failed: expected schema found times 2, actual %d"
% (caller.filename, caller.lineno, int(schemaTimes))
)
taosdumpInspectCmd = (
"%s -I %s/taosdump*/*.avro* | grep '=== Records:'|wc -l"
% (binPath, self.tmpdir)
)
recordsTimes = subprocess.check_output(taosdumpInspectCmd, shell=True).decode(
"utf-8"
)
print("records found times: %d" % int(recordsTimes))
if int(recordsTimes) != 1:
caller = inspect.getframeinfo(inspect.stack()[0][0])
tdLog.exit(
"%s(%d) failed: expected records found times 1, actual %d"
% (caller.filename, caller.lineno, int(recordsTimes))
)
taosdumpInspectCmd = (
"%s -I %s/taosdump*/data*/*.avro* | grep '=== Records:'|wc -l"
% (binPath, self.tmpdir)
)
recordsTimes = subprocess.check_output(taosdumpInspectCmd, shell=True).decode(
"utf-8"
)
print("records found times: %d" % int(recordsTimes))
if (int(recordsTimes) != 3):
if int(recordsTimes) != 2:
caller = inspect.getframeinfo(inspect.stack()[0][0])
tdLog.exit(
"%s(%d) failed: expected records found times 3, actual %d" %
(caller.filename, caller.lineno, int(recordsTimes)))
"%s(%d) failed: expected records found times 2, actual %d"
% (caller.filename, caller.lineno, int(recordsTimes))
)
def stop(self):
tdSql.close()
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -37,8 +35,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -53,7 +55,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -98,7 +100,16 @@ class TDTestCase:
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -37,8 +35,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -53,7 +55,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -86,7 +88,16 @@ class TDTestCase:
os.system("%staosdump -i %s" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......@@ -95,14 +106,16 @@ class TDTestCase:
tdSql.query("show tables")
tdSql.checkRows(2)
tdSql.checkData(0, 0, 't2')
tdSql.checkData(1, 0, 't1')
dbresult = tdSql.queryResult
print(dbresult)
for i in range(len(dbresult)):
assert ((dbresult[i][0] == "t1") or (dbresult[i][0] == "t2"))
tdSql.query("select btag from st where tbname = 't1'")
tdSql.query("select distinct(btag) from st where tbname = 't1'")
tdSql.checkRows(1)
tdSql.checkData(0, 0, "test")
tdSql.query("select btag from st where tbname = 't2'")
tdSql.query("select distinct(btag) from st where tbname = 't2'")
tdSql.checkRows(1)
tdSql.checkData(0, 0, None)
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -37,8 +35,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -53,7 +55,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -87,7 +89,16 @@ class TDTestCase:
os.system("%staosdump -i %s" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......@@ -96,22 +107,22 @@ class TDTestCase:
tdSql.query("show tables")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 't3')
tdSql.checkData(1, 0, 't2')
tdSql.checkData(2, 0, 't1')
dbresult = tdSql.queryResult
print(dbresult)
for i in range(len(dbresult)):
assert ((dbresult[i][0] == "t1") or (dbresult[i][0] == "t2") or (dbresult[i][0] == "t3"))
tdSql.query("select btag from st")
tdSql.checkRows(3)
tdSql.checkData(0, 0, "False")
tdSql.checkData(1, 0, "True")
tdSql.checkData(2, 0, None)
dbresult = tdSql.queryResult
print(dbresult)
tdSql.query("select * from st where btag = 'true'")
tdSql.query("select * from st where btag = true")
tdSql.checkRows(1)
tdSql.checkData(0, 1, "True")
tdSql.checkData(0, 2, "True")
tdSql.query("select * from st where btag = 'false'")
tdSql.query("select * from st where btag = false")
tdSql.checkRows(1)
tdSql.checkData(0, 1, "False")
tdSql.checkData(0, 2, "False")
......
......@@ -11,14 +11,12 @@
# -*- coding: utf-8 -*-
import sys
import os
import math
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -38,8 +36,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -54,7 +56,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -97,7 +99,16 @@ class TDTestCase:
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
......@@ -11,14 +11,12 @@
# -*- coding: utf-8 -*-
import sys
import os
import math
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -38,8 +36,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -54,7 +56,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -97,7 +99,16 @@ class TDTestCase:
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -32,28 +30,34 @@ class TDTestCase:
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getBuildPath(self):
def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
paths = []
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
paths.append(os.path.join(root, tool))
break
return buildPath
if (len(paths) == 0):
return ""
return paths[0]
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649")
tdSql.execute("use db")
tdSql.execute(
......@@ -69,12 +73,11 @@ class TDTestCase:
# sys.exit(1)
buildPath = self.getBuildPath()
if (buildPath == ""):
binPath = self.getPath()
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
tdLog.info("taosdump found in %s" % binPath)
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
......@@ -84,16 +87,25 @@ class TDTestCase:
os.makedirs(self.tmpdir)
os.system(
"%staosdump --databases db -o %s -T 1" %
"%s --databases db -o %s -T 1" %
(binPath, self.tmpdir))
# sys.exit(1)
tdSql.execute("drop database db")
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
os.system("%s -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -37,8 +35,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -53,7 +55,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -93,7 +95,16 @@ class TDTestCase:
os.system("%staosdump -i %s -g" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......@@ -102,11 +113,24 @@ class TDTestCase:
tdSql.query("show tables")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 't3')
dbresult = tdSql.queryResult
print(dbresult)
for i in range(len(dbresult)):
assert ((dbresult[i][0] == "t1") or (dbresult[i][0] == "t2") or (dbresult[i][0] == "t3"))
tdSql.query("select jtag->'location' from st")
tdSql.checkRows(3)
tdSql.checkData(0, 0, "\"beijing\"")
dbresult = tdSql.queryResult
print(dbresult)
found = False
for i in range(len(dbresult)):
if (dbresult[i][0] == "\"beijing\""):
found = True
break
assert found == True
tdSql.query("select * from st where jtag contains 'location'")
tdSql.checkRows(1)
......@@ -115,9 +139,16 @@ class TDTestCase:
tdSql.query("select jtag from st")
tdSql.checkRows(3)
tdSql.checkData(0, 0, "{\"location\":\"beijing\"}")
tdSql.checkData(1, 0, None)
tdSql.checkData(2, 0, None)
dbresult = tdSql.queryResult
print(dbresult)
found = False
for i in range(len(dbresult)):
if (dbresult[i][0] == "{\"location\":\"beijing\"}"):
found = True
break
assert found == True
def stop(self):
tdSql.close()
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -32,27 +30,34 @@ class TDTestCase:
tdSql.init(conn.cursor(), logSql)
self.tmpdir = "tmp"
def getBuildPath(self):
def getPath(self, tool="taosdump"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
paths = []
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
paths.append(os.path.join(root, tool))
break
return buildPath
if (len(paths) == 0):
return ""
return paths[0]
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -69,14 +74,12 @@ class TDTestCase:
tdSql.execute("create table t4 using st tags(NULL)")
tdSql.execute("insert into t4 values(1640000000000, NULL)")
# sys.exit(1)
buildPath = self.getBuildPath()
if (buildPath == ""):
binPath = self.getPath()
if (binPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
tdLog.info("taosdump found: %s" % binPath)
if not os.path.exists(self.tmpdir):
os.makedirs(self.tmpdir)
......@@ -86,16 +89,25 @@ class TDTestCase:
os.makedirs(self.tmpdir)
os.system(
"%staosdump --databases db -o %s -T 1" %
"%s --databases db -o %s -T 1" %
(binPath, self.tmpdir))
# sys.exit(1)
tdSql.execute("drop database db")
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
os.system("%s -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -37,8 +35,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
......@@ -52,7 +54,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -95,7 +97,16 @@ class TDTestCase:
os.system("%staosdump -i %s -T 1" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -37,8 +35,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -53,7 +55,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -91,7 +93,16 @@ class TDTestCase:
os.system("%staosdump -i %s -T 1 -g" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -37,8 +35,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -53,7 +55,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -91,7 +93,16 @@ class TDTestCase:
os.system("%staosdump -i %s -T 1 -g" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -37,8 +35,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -53,7 +55,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -91,7 +93,16 @@ class TDTestCase:
os.system("%staosdump -i %s -T 1 -g" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
......@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
......@@ -37,8 +35,12 @@ class TDTestCase:
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
elif ("src" in selfPath):
projPath = selfPath[:selfPath.find("src")]
elif ("/tools/" in selfPath):
projPath = selfPath[:selfPath.find("/tools/")]
else:
projPath = selfPath[:selfPath.find("tests")]
tdLog.exit("path: %s is not supported" % selfPath)
buildPath = ""
for root, dirs, files in os.walk(projPath):
......@@ -53,7 +55,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute("drop database if exists db")
tdSql.execute("create database db days 11 keep 3649 blocks 8 ")
tdSql.execute("create database db keep 3649 ")
tdSql.execute("use db")
tdSql.execute(
......@@ -91,7 +93,16 @@ class TDTestCase:
os.system("%staosdump -i %s -T 1 -g" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
dbresult = tdSql.queryResult
found = False
for i in range(len(dbresult)):
print("Found db: %s" % dbresult[i][0])
if (dbresult[i][0] == "db"):
found = True
break
assert found == True
tdSql.execute("use db")
tdSql.query("show stables")
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册