未验证 提交 834807fe 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #10637 from taosdata/xiaoping/2.4

[TS-1289][TS-1255][TS-1286]: add test cases
......@@ -36,6 +36,25 @@ class TDTestCase:
tdSql.query("create table db.test2 using db.state2 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):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
......@@ -17,7 +17,8 @@ from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import string
import random
class TDTestCase:
def init(self, conn, logSql):
......@@ -45,6 +46,13 @@ class TDTestCase:
break
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):
tdSql.prepare()
......@@ -76,14 +84,14 @@ class TDTestCase:
os.makedirs(self.tmpdir)
os.system(
"%staosdump --databases db -o %s -B 16384 " %
"%staosdump --databases db -o %s -B 16384 -y" %
(binPath, self.tmpdir))
tdSql.execute("drop database db")
tdSql.query("show databases")
tdSql.checkRows(0)
os.system("%staosdump -i %s" % (binPath, self.tmpdir))
os.system("%staosdump -i %s -y" % (binPath, self.tmpdir))
tdSql.query("show databases")
tdSql.checkRows(1)
......@@ -96,6 +104,33 @@ class TDTestCase:
tdSql.query("select count(*) from t1")
tdSql.checkData(0, 0, self.numberOfRecords)
os.system("rm -rf %s" % self.tmpdir)
# test case for TS-1225
tdSql.execute("create database test")
tdSql.execute("use test")
tdSql.execute("create table stb(ts timestamp, c1 binary(16374), c2 binary(16374), c3 binary(16374)) tags(t1 nchar(256))")
tdSql.execute("insert into t1 using stb tags('t1') values(now, '%s', '%s', '%s')" % (self.generateString(16374), self.generateString(16374), self.generateString(16374)))
os.system("rm /tmp/*.sql")
os.system("rm /tmp/*.avro*")
os.system("%staosdump -D test -o /tmp -y" % binPath)
tdSql.execute("drop database test")
tdSql.query("show databases")
tdSql.checkRows(1)
os.system("%staosdump -i /tmp -y" % 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)
os.system("rm -rf dump_result.txt")
def stop(self):
tdSql.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册