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

fix test cases

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