提交 837cf038 编写于 作者: P Ping Xiao

[TS-1289][TS-1255][TS-1286]: add test cases

上级 c11c8092
Subproject commit 14fb199c68ed7d32d616cd9be231b332ceae9911 Subproject commit c7895975ca625b6380a48211c7b9102f967f6451
...@@ -34,7 +34,26 @@ class TDTestCase: ...@@ -34,7 +34,26 @@ class TDTestCase:
tdSql.execute("drop table if exists db.state2;") tdSql.execute("drop table if exists db.state2;")
tdSql.execute("create table db.state2 (ts timestamp, c1 int) tags (t binary(20));") tdSql.execute("create table db.state2 (ts timestamp, c1 int) tags (t binary(20));")
tdSql.query("create table db.test2 using db.state2 tags('tt');") tdSql.query("create table db.test2 using db.state2 tags('tt');")
tdSql.error("create table db.test22 using db.test2 tags('tt');") tdSql.error("create table db.test22 using db.test2 tags('tt');")
# test case for TS-1289
tdSql.execute("create database test")
tdSql.execute("use test")
tdSql.execute("create table `metrics` (`ts` TIMESTAMP,`value` DOUBLE) TAGS (`labels` JSON)")
tdSql.execute('''CREATE TABLE `t_eb22c740776471c56ed97eff4951eb41` USING `metrics` TAGS ('{"__name__":"node_exporter:memory:used:percent","datacenter":"cvte
","hostname":"p-tdengine-s-002","instance":"10.21.46.53:9100","ipaddress":"10.21.46.53","job":"node","product":"Prometheus","productline":"INFRA
"}');''')
tdSql.query("show create table t_eb22c740776471c56ed97eff4951eb41")
sql = tdSql.getData(0, 1)
tdSql.execute("drop table t_eb22c740776471c56ed97eff4951eb41")
tdSql.query("show tables")
tdSql.checkRows(0)
tdSql.execute(sql)
tdSql.query("show tables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 't_eb22c740776471c56ed97eff4951eb41')
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -17,6 +17,8 @@ from util.log import * ...@@ -17,6 +17,8 @@ from util.log import *
from util.cases import * from util.cases import *
from util.sql import * from util.sql import *
from util.dnodes import * from util.dnodes import *
import string
import random
class TDTestCase: class TDTestCase:
...@@ -44,6 +46,13 @@ class TDTestCase: ...@@ -44,6 +46,13 @@ class TDTestCase:
break break
return buildPath return buildPath
def generateString(self, length):
chars = string.ascii_uppercase + string.ascii_lowercase
v = ""
for i in range(length):
v += random.choice(chars)
return v
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
...@@ -91,6 +100,30 @@ class TDTestCase: ...@@ -91,6 +100,30 @@ class TDTestCase:
tdSql.query("select count(*) from t1") tdSql.query("select count(*) from t1")
tdSql.checkData(0, 0, self.numberOfRecords) tdSql.checkData(0, 0, self.numberOfRecords)
tdSql.execute("create database test")
tdSql.execute("use test")
tdSql.execute("create table stb(ts timestamp, c1 binary(16000), c2 binary(16000), c3 binary(10000)) tags(t1 nchar(256))")
tdSql.execute("insert into t1 using stb tags('t1') values(now, '%s', '%s', '%s')" % (self.generateString(16000), self.generateString(16000), self.generateString(10000)))
os.system("rm /tmp/*.sql")
os.system("rm /tmp/*.avro*")
os.system("%staosdump -D test -o /tmp" % binPath)
tdSql.execute("drop database test")
tdSql.query("show databases")
tdSql.checkRows(0)
os.system("%staosdump -i /tmp" % binPath)
tdSql.execute("use test")
tdSql.error("show vnodes '' ")
tdSql.query("show stables")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'stb')
tdSql.query("select * from stb")
tdSql.checkRows(1)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册