提交 a1650cff 编写于 作者: G Ganlin Zhao

fix test cases

上级 2acf94be
......@@ -1315,7 +1315,7 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
......
......@@ -1859,8 +1859,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -2287,8 +2287,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -2735,8 +2735,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -50,8 +50,8 @@ class TDTestCase:
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def run(self):
......@@ -122,4 +122,4 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
tdCases.addLinux(__file__, TDTestCase())
......@@ -2059,8 +2059,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -43,9 +43,9 @@ class TDTestCase:
tdSql.checkData(0, 6, None)
tdSql.checkData(1, 6, 'test')
# Test case for: https://jira.taosdata.com:18080/browse/TD-2423
# Test case for: https://jira.taosdata.com:18080/browse/TD-2423
tdSql.execute("create table stb(ts timestamp, col1 int, col2 nchar(20)) tags(tg1 int, tg2 binary(20), tg3 nchar(25))")
tdSql.execute("insert into tb1 using stb(tg1, tg3) tags(1, 'test1') values(now, 1, 'test1')")
tdSql.execute("insert into tb1 using stb(tg1, tg3) tags(1, 'test1') values(now, 1, 'test1')")
tdSql.query("select *, tg1, tg2, tg3 from tb1")
tdSql.checkRows(1)
tdSql.checkData(0, 3, 1)
......@@ -61,7 +61,7 @@ class TDTestCase:
#Test case for TS-1285
tdSql.execute("create table stb2(ts timestamp, c1 int) tags(t1 timestamp)")
tdSql.execute("insert into tb3 using stb2 tags('2022-01-01 18:26:50.224') values(now, 1)")
tdSql.execute("insert into tb3 using stb2 tags('2022-01-01 18:26:50.224') values(now, 1)")
tdSql.execute("alter table tb3 set tag t1='2022-03-03 18:26:50.224'")
tdSql.query("select * from stb2")
tdSql.checkData(0, 2, "2022-03-03 18:26:50.224")
......
......@@ -565,8 +565,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......@@ -577,15 +577,15 @@ class TDTestCase:
tdSql.execute("use db")
tdSql.execute(
"create table if not exists st (ts timestamp, tagtype int) tags(dev bigint)")
tdSql.execute(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 63) - 1))
tdSql.execute(
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (-1 * pow(2, 63) + 1))
print("==============step2")
print("==============step2")
tdSql.query("show tables")
tdSql.checkRows(2)
tdSql.checkRows(2)
def stop(self):
tdSql.close()
......
......@@ -569,8 +569,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......@@ -583,13 +583,13 @@ class TDTestCase:
"create table if not exists st (ts timestamp, tagtype int) tags(dev binary(5))")
tdSql.error(
'CREATE TABLE if not exists dev_001 using st tags("dev_001")')
tdSql.execute(
'CREATE TABLE if not exists dev_002 using st tags("dev")')
print("==============step2")
print("==============step2")
tdSql.query("show tables")
tdSql.checkRows(1)
tdSql.checkRows(1)
def stop(self):
tdSql.close()
......
......@@ -780,7 +780,7 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
......
......@@ -564,8 +564,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -774,8 +774,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -806,7 +806,7 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
......
......@@ -928,8 +928,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -180,8 +180,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -2304,7 +2304,7 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
......
......@@ -1701,8 +1701,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -565,8 +565,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -355,8 +355,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -565,8 +565,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -564,7 +564,7 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
......
......@@ -772,8 +772,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -808,7 +808,7 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
......
......@@ -47,16 +47,16 @@ class TDTestCase:
print("==============step1 tag format =======")
tdLog.info("create database ")
tdSql.execute("create database db_json")
tdSql.execute("use db_json")
# test tag format
tdSql.execute("use db_json")
# test tag format
tdSql.execute("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json)")
tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json(10000000))")
tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json,jtag1 json)")
tdSql.error("create table if not exists jsons1(ts timestamp, dataInt int, dataStr nchar(50)) tags(jtag json,dataBool bool)")
tdSql.execute("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{\"loc\":\"fff\",\"id\":5}')")
# two stables: jsons1 jsons2 ,test tag's value and key
# two stables: jsons1 jsons2 ,test tag's value and key
tdSql.execute("insert into jsons1_1(ts,dataInt) using jsons1 tags('{\"loc+\":\"fff\",\"id\":5}') values (now,12)")
tdSql.error("CREATE TABLE if not exists jsons1_1 using jsons1 tags('{oc:\"fff\",\"id\":5}')")
......
......@@ -35,7 +35,7 @@ class TDTestCase:
'CREATE TABLE if not exists dev_002 using st tags("dev")')
print("==============step2")
print("==============step2")
tdSql.query("show tables")
tdSql.checkRows(1)
......
......@@ -879,8 +879,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......
......@@ -565,8 +565,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......@@ -580,15 +580,15 @@ class TDTestCase:
'CREATE TABLE if not exists dev_001 using st tags(%d)' % pow(2, 15))
tdSql.error(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1 * pow(2, 15)))
tdSql.execute(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 15) - 1))
tdSql.execute(
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (-1 * pow(2, 15) + 1))
print("==============step2")
print("==============step2")
tdSql.query("show tables")
tdSql.checkRows(2)
tdSql.checkRows(2)
def stop(self):
tdSql.close()
......
......@@ -46,7 +46,7 @@ class TDTestCase:
tdLog.info('=============== step2')
tdSql.query('select * from %s' % (mt))
tdSql.checkRows(5 * rowNum)
tdSql.query('select * from %s where tgTs = %ld and tgcol2 = 0' % (mt, ts))
tdSql.checkRows(rowNum)
......@@ -54,7 +54,7 @@ class TDTestCase:
tdSql.checkRows(rowNum)
tdLog.info('=============== step3')
i = 0
i = 0
while (i < 5):
tb = "%s%d" % (tbPrefix, i + 100)
tdLog.info('create table %s using %s tags(%d, \"%s\", %d)' % (tb, mt, i + 100, tsStr, i + 100))
......@@ -80,7 +80,7 @@ class TDTestCase:
tdLog.info('=============== step4')
i = 0
tb = "%s%d"%(tbPrefix, i + 1000)
tb = "%s%d"%(tbPrefix, i + 1000)
tdSql.execute('insert into %s using %s tags(%d, \"%s\", %d) values(now, 10)' % (tb, mt, i + 100, tsStr, i + 1000))
tdSql.execute('insert into %s using %s tags(%d, \"%s\", %d) values(now+2s, 10)' % (tb, mt, i + 100, tsStr, i + 1000))
tdSql.execute('insert into %s using %s tags(%d, \"%s\", %d) values(now+3s, 10)' % (tb, mt, i + 100, tsStr, i + 1000))
......@@ -88,11 +88,11 @@ class TDTestCase:
tdSql.checkRows(3)
i = 0
tb = "%s%d"%(tbPrefix, i + 10000)
tb = "%s%d"%(tbPrefix, i + 10000)
tdSql.execute('create table %s using %s tags(%d, now, %d)' % (tb, mt, i + 10000,i + 10000))
tdSql.checkRows(3)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
......@@ -565,8 +565,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......@@ -581,15 +581,15 @@ class TDTestCase:
'CREATE TABLE if not exists dev_001 using st tags(%d)' % pow(2, 7))
tdSql.error(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1 * pow(2, 7)))
tdSql.execute(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 7) - 1))
tdSql.execute(
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (-1 * pow(2, 7) + 1))
print("==============step2")
print("==============step2")
tdSql.query("show tables")
tdSql.checkRows(2)
tdSql.checkRows(2)
def stop(self):
tdSql.close()
......
......@@ -13,12 +13,12 @@ class TDTestCase:
def run(self):
tdSql.prepare()
tdLog.info('======================== dnode1 start')
tbPrefix = "ta_cr_tb"
mtPrefix = "ta_cr_mt"
tbNum = 2
rowNum = 10
tbNum = 2
rowNum = 10
totalNum = 200
tagCondsLimit = 1024
tdLog.info('=============== step1: create tbl and prepare data')
......@@ -26,40 +26,40 @@ class TDTestCase:
i = 2
mt = "%s%d" % (mtPrefix, i)
tb = "%s%d" % (tbPrefix, i)
sql ='create table %s (ts timestamp, tbcol int) TAGS(tgcol int)'% (mt)
tdLog.info(sql)
tdSql.execute(sql)
for i in range(0, tbNum):
for i in range(0, tbNum):
tblName = "%s%d"%(tbPrefix, i)
sql = 'create table %s using %s TAGS(%d)'%(tblName, mt, i)
sql = 'create table %s using %s TAGS(%d)'%(tblName, mt, i)
tdSql.execute(sql)
for j in range(0, rowNum):
sql = "insert into %s values(now, %d)"%(tblName, j)
sql = "insert into %s values(now, %d)"%(tblName, j)
tdSql.execute(sql)
sqlPrefix = "select * from %s where "%(mt)
sqlPrefix = "select * from %s where "%(mt)
for i in range(2, 2048, 1):
conds = "tgcol=1 and "* (i - 1)
conds = "%stgcol=1"%(conds)
sql = "%s%s"%(sqlPrefix, conds)
if i >= tagCondsLimit:
if i >= tagCondsLimit:
tdSql.error(sql)
else:
else:
tdSql.query(sql)
#tdSql.checkRows(1)
for i in range(2, 2048, 1):
conds = ""
for j in range(0, i - 1):
conds = ""
for j in range(0, i - 1):
conds = conds + "tgcol=%d or "%(j%tbNum)
conds += "tgcol=%d"%(i%tbNum)
sql = sqlPrefix + conds
sql = sqlPrefix + conds
if i >= tagCondsLimit:
tdSql.error(sql)
else:
else:
tdSql.query(sql)
def stop(self):
tdSql.close()
......
......@@ -565,8 +565,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......@@ -580,16 +580,16 @@ class TDTestCase:
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 64) - 1))
tdSql.error(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1))
tdSql.execute(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 64) - 2))
tdSql.execute(
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (0))
tdSql.execute(
'CREATE TABLE if not exists dev_003 using st tags(%s)' % ('NULL'))
print("==============step2")
print("==============step2")
tdSql.query("show tables")
tdSql.checkRows(3)
tdSql.checkRows(3)
def stop(self):
tdSql.close()
......
......@@ -566,8 +566,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......@@ -581,16 +581,16 @@ class TDTestCase:
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 32) - 1))
tdSql.error(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1))
tdSql.execute(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 32) - 2))
tdSql.execute(
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (0))
tdSql.execute(
'CREATE TABLE if not exists dev_003 using st tags(%s)' % ('NULL'))
print("==============step2")
print("==============step2")
tdSql.query("show tables")
tdSql.checkRows(3)
tdSql.checkRows(3)
def stop(self):
tdSql.close()
......
......@@ -565,8 +565,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......@@ -580,7 +580,7 @@ class TDTestCase:
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 16)-1))
tdSql.error(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1))
tdSql.execute(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 16) - 2))
tdSql.execute(
......@@ -588,9 +588,9 @@ class TDTestCase:
tdSql.execute(
'CREATE TABLE if not exists dev_003 using st tags(%s)' % ('NULL'))
print("==============step2")
print("==============step2")
tdSql.query("show tables")
tdSql.checkRows(3)
tdSql.checkRows(3)
def stop(self):
tdSql.close()
......
......@@ -565,8 +565,8 @@ class TDTestCase:
tdLog.info('show databases')
tdSql.query('show databases')
# TSIM: if $rows != 0 then
tdLog.info('tdSql.checkRow(0)')
tdSql.checkRows(0)
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
# TSIM: return -1
# TSIM: endi
# TSIM:
......@@ -580,16 +580,16 @@ class TDTestCase:
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 8) - 1))
tdSql.error(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (-1))
tdSql.execute(
'CREATE TABLE if not exists dev_001 using st tags(%d)' % (pow(2, 8) - 2))
tdSql.execute(
'CREATE TABLE if not exists dev_002 using st tags(%d)' % (0))
tdSql.execute(
'CREATE TABLE if not exists dev_003 using st tags(%s)' % ('NULL'))
print("==============step2")
print("==============step2")
tdSql.query("show tables")
tdSql.checkRows(3)
tdSql.checkRows(3)
def stop(self):
tdSql.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册