提交 2f7644b4 编写于 作者: S Shuduo Sang

fix autopep8 format.

上级 35f5a204
...@@ -29,14 +29,14 @@ class TDTestCase: ...@@ -29,14 +29,14 @@ class TDTestCase:
def run(self): def run(self):
chars = string.ascii_uppercase+string.ascii_lowercase chars = string.ascii_uppercase + string.ascii_lowercase
getDbNameLen = "grep -w '#define TSDB_DB_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'" getDbNameLen = "grep -w '#define TSDB_DB_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
dbNameMaxLen = int(subprocess.check_output(getDbNameLen, shell=True)) dbNameMaxLen = int(subprocess.check_output(getDbNameLen, shell=True))
tdLog.notice("DB name max length is %d" % dbNameMaxLen) tdLog.notice("DB name max length is %d" % dbNameMaxLen)
tdLog.info("=============== step1") tdLog.info("=============== step1")
db_name = ''.join(random.choices(chars, k=(dbNameMaxLen+1))) db_name = ''.join(random.choices(chars, k=(dbNameMaxLen + 1)))
tdLog.info('db_name length %d' % len(db_name)) tdLog.info('db_name length %d' % len(db_name))
tdLog.info('create database %s' % db_name) tdLog.info('create database %s' % db_name)
tdSql.error('create database %s' % db_name) tdSql.error('create database %s' % db_name)
...@@ -52,7 +52,7 @@ class TDTestCase: ...@@ -52,7 +52,7 @@ class TDTestCase:
tdSql.checkData(0, 0, db_name.lower()) tdSql.checkData(0, 0, db_name.lower())
tdLog.info("=============== step3") tdLog.info("=============== step3")
db_name = ''.join(random.choices(chars, k=(dbNameMaxLen-1))) db_name = ''.join(random.choices(chars, k=(dbNameMaxLen - 1)))
tdLog.info('db_name length %d' % len(db_name)) tdLog.info('db_name length %d' % len(db_name))
tdLog.info('create database %s' % db_name) tdLog.info('create database %s' % db_name)
tdSql.execute('create database %s' % db_name) tdSql.execute('create database %s' % db_name)
......
...@@ -25,7 +25,21 @@ class TDTestCase: ...@@ -25,7 +25,21 @@ class TDTestCase:
tdSql.error("insert into tb values (now, )") tdSql.error("insert into tb values (now, )")
with open("../../README.md", "r") as inputFile: with open("../../README.md", "r") as inputFile:
data = inputFile.read(4084).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ") data = inputFile.read(4084).replace(
"\n",
" ").replace(
"\\",
" ").replace(
"\'",
" ").replace(
"\"",
" ").replace(
"[",
" ").replace(
"]",
" ").replace(
"!",
" ")
tdLog.info("insert %d length data: %s" % (len(data), data)) tdLog.info("insert %d length data: %s" % (len(data), data))
...@@ -39,17 +53,79 @@ class TDTestCase: ...@@ -39,17 +53,79 @@ class TDTestCase:
tdLog.info("tdSql.checkData(0, 1, '%s')" % data) tdLog.info("tdSql.checkData(0, 1, '%s')" % data)
tdSql.checkData(0, 1, data) tdSql.checkData(0, 1, data)
tdLog.info('create table tb2 (ts timestamp, speed binary(2040), temp binary(2044))') tdLog.info(
tdSql.execute('create table tb2 (ts timestamp, speed binary(2040), temp binary(2044))') 'create table tb2 (ts timestamp, speed binary(2040), temp binary(2044))')
speed = inputFile.read(2044).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ") tdSql.execute(
temp = inputFile.read(2040).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ") 'create table tb2 (ts timestamp, speed binary(2040), temp binary(2044))')
speed = inputFile.read(2044).replace(
"\n",
" ").replace(
"\\",
" ").replace(
"\'",
" ").replace(
"\"",
" ").replace(
"[",
" ").replace(
"]",
" ").replace(
"!",
" ")
temp = inputFile.read(2040).replace(
"\n",
" ").replace(
"\\",
" ").replace(
"\'",
" ").replace(
"\"",
" ").replace(
"[",
" ").replace(
"]",
" ").replace(
"!",
" ")
tdLog.info("insert into tb values (now+3a, speed, temp)") tdLog.info("insert into tb values (now+3a, speed, temp)")
tdSql.error("insert into tb values (now+3a, '%s', '%s')" % (speed, temp)) tdSql.error(
"insert into tb values (now+3a, '%s', '%s')" %
speed = inputFile.read(2040).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ") (speed, temp))
temp = inputFile.read(2044).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ")
speed = inputFile.read(2040).replace(
"\n",
" ").replace(
"\\",
" ").replace(
"\'",
" ").replace(
"\"",
" ").replace(
"[",
" ").replace(
"]",
" ").replace(
"!",
" ")
temp = inputFile.read(2044).replace(
"\n",
" ").replace(
"\\",
" ").replace(
"\'",
" ").replace(
"\"",
" ").replace(
"[",
" ").replace(
"]",
" ").replace(
"!",
" ")
tdLog.info("insert into tb values (now+4a, speed, temp)") tdLog.info("insert into tb values (now+4a, speed, temp)")
tdSql.error("insert into tb values (now+4a, '%s', '%s')" % (speed, temp)) tdSql.error(
"insert into tb values (now+4a, '%s', '%s')" %
(speed, temp))
tdLog.info('tdSql.checkRow(2)') tdLog.info('tdSql.checkRow(2)')
tdSql.checkRows(2) tdSql.checkRows(2)
......
...@@ -33,7 +33,21 @@ class TDTestCase: ...@@ -33,7 +33,21 @@ class TDTestCase:
tdSql.checkData(0, 1, 'taosdata') tdSql.checkData(0, 1, 'taosdata')
with open("../../README.md", "r") as inputFile: with open("../../README.md", "r") as inputFile:
data = inputFile.read(1021).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ") data = inputFile.read(1021).replace(
"\n",
" ").replace(
"\\",
" ").replace(
"\'",
" ").replace(
"\"",
" ").replace(
"[",
" ").replace(
"]",
" ").replace(
"!",
" ")
tdLog.info("insert %d length data: %s" % (len(data), data)) tdLog.info("insert %d length data: %s" % (len(data), data))
......
...@@ -37,7 +37,7 @@ class TDTestCase: ...@@ -37,7 +37,7 @@ class TDTestCase:
print("==============step2") print("==============step2")
tdSql.execute( tdSql.execute(
"""INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:00.000', 1), """INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:00.000', 1),
('2020-05-13 10:00:00.001', 1) ('2020-05-13 10:00:00.001', 1)
dev_002 VALUES('2020-05-13 10:00:00.001', 1)""") dev_002 VALUES('2020-05-13 10:00:00.001', 1)""")
......
...@@ -37,7 +37,7 @@ class TDTestCase: ...@@ -37,7 +37,7 @@ class TDTestCase:
print("==============step2") print("==============step2")
tdSql.execute( tdSql.execute(
"""INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:00.000', 1), """INSERT INTO dev_001(ts, tagtype) VALUES('2020-05-13 10:00:00.000', 1),
('2020-05-13 10:00:00.001', 1) ('2020-05-13 10:00:00.001', 1)
dev_002 VALUES('2020-05-13 10:00:00.001', 1)""") dev_002 VALUES('2020-05-13 10:00:00.001', 1)""")
......
...@@ -18,18 +18,24 @@ class TDTestCase: ...@@ -18,18 +18,24 @@ class TDTestCase:
tdSql.prepare() tdSql.prepare()
getTableNameLen = "grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'" getTableNameLen = "grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
tableNameMaxLen = int(subprocess.check_output(getTableNameLen, shell=True)) tableNameMaxLen = int(
subprocess.check_output(
getTableNameLen, shell=True))
tdLog.notice("table name max length is %d" % tableNameMaxLen) tdLog.notice("table name max length is %d" % tableNameMaxLen)
chars = string.ascii_uppercase+string.ascii_lowercase chars = string.ascii_uppercase + string.ascii_lowercase
tb_name = ''.join(random.choices(chars, k=tableNameMaxLen)) tb_name = ''.join(random.choices(chars, k=tableNameMaxLen))
tdLog.info('tb_name length %d' % len(tb_name)) tdLog.info('tb_name length %d' % len(tb_name))
tdLog.info('create table %s (ts timestamp, value int)' % tb_name) tdLog.info('create table %s (ts timestamp, value int)' % tb_name)
tdSql.error('create table %s (ts timestamp, speed binary(4089))' % tb_name) tdSql.error(
'create table %s (ts timestamp, speed binary(4089))' %
tb_name)
tb_name = ''.join(random.choices(chars, k=191)) tb_name = ''.join(random.choices(chars, k=191))
tdLog.info('tb_name length %d' % len(tb_name)) tdLog.info('tb_name length %d' % len(tb_name))
tdLog.info('create table %s (ts timestamp, value int)' % tb_name) tdLog.info('create table %s (ts timestamp, value int)' % tb_name)
tdSql.execute('create table %s (ts timestamp, speed binary(4089))' % tb_name) tdSql.execute(
'create table %s (ts timestamp, speed binary(4089))' %
tb_name)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -33,19 +33,27 @@ class TDTestCase: ...@@ -33,19 +33,27 @@ class TDTestCase:
stb_name = "stb%d" % x stb_name = "stb%d" % x
tagSeq = "tag0 int" tagSeq = "tag0 int"
for y in range(1, x+1): for y in range(1, x + 1):
tagSeq = tagSeq + ", tag%d int" % y tagSeq = tagSeq + ", tag%d int" % y
tdLog.info("create table %s (ts timestamp, value int) tags (%s)" % (stb_name, tagSeq)) tdLog.info(
tdSql.execute("create table %s (ts timestamp, value int) tags (%s)" % (stb_name, tagSeq)) "create table %s (ts timestamp, value int) tags (%s)" %
(stb_name, tagSeq))
tdSql.execute(
"create table %s (ts timestamp, value int) tags (%s)" %
(stb_name, tagSeq))
tdSql.query("show stables") tdSql.query("show stables")
tdSql.checkRows(boundary) tdSql.checkRows(boundary)
stb_name = "stb%d" % (boundary+1) stb_name = "stb%d" % (boundary + 1)
tagSeq = tagSeq + ", tag%d int" % (boundary) tagSeq = tagSeq + ", tag%d int" % (boundary)
tdLog.info("create table %s (ts timestamp, value int) tags (%s)" % (stb_name, tagSeq)) tdLog.info(
tdSql.error("create table %s (ts timestamp, value int) tags (%s)" % (stb_name, tagSeq)) "create table %s (ts timestamp, value int) tags (%s)" %
(stb_name, tagSeq))
tdSql.error(
"create table %s (ts timestamp, value int) tags (%s)" %
(stb_name, tagSeq))
tdSql.query("show stables") tdSql.query("show stables")
tdSql.checkRows(boundary) tdSql.checkRows(boundary)
......
...@@ -103,7 +103,8 @@ class TDDnode: ...@@ -103,7 +103,8 @@ class TDDnode:
self.logDir = "%s/pysim/dnode%d/log" % (self.path, self.index) self.logDir = "%s/pysim/dnode%d/log" % (self.path, self.index)
self.dataDir = "%s/pysim/dnode%d/data" % (self.path, self.index) self.dataDir = "%s/pysim/dnode%d/data" % (self.path, self.index)
self.cfgDir = "%s/pysim/dnode%d/cfg" % (self.path, self.index) self.cfgDir = "%s/pysim/dnode%d/cfg" % (self.path, self.index)
self.cfgPath = "%s/pysim/dnode%d/cfg/taos.cfg" % (self.path, self.index) self.cfgPath = "%s/pysim/dnode%d/cfg/taos.cfg" % (
self.path, self.index)
cmd = "rm -rf " + self.dataDir cmd = "rm -rf " + self.dataDir
if os.system(cmd) != 0: if os.system(cmd) != 0:
...@@ -188,7 +189,7 @@ class TDDnode: ...@@ -188,7 +189,7 @@ class TDDnode:
rootRealPath = os.path.dirname(os.path.realpath(root)) rootRealPath = os.path.dirname(os.path.realpath(root))
if ("community" not in rootRealPath): if ("community" not in rootRealPath):
binPath = os.path.join(root, "taosd") binPath = os.path.join(root, "taosd")
break; break
else: else:
projPath = selfPath + "/../../../" projPath = selfPath + "/../../../"
for root, dirs, files in os.walk(projPath): for root, dirs, files in os.walk(projPath):
...@@ -196,7 +197,7 @@ class TDDnode: ...@@ -196,7 +197,7 @@ class TDDnode:
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):
binPath = os.path.join(root, "taosd") binPath = os.path.join(root, "taosd")
break; break
if (binPath == ""): if (binPath == ""):
tdLog.exit("taosd not found!s") tdLog.exit("taosd not found!s")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册