未验证 提交 8827cff1 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #10628 from taosdata/xiaoping/cases

[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__)
......
......@@ -11,15 +11,19 @@
# -*- coding: utf-8 -*-
from logging.config import dictConfig
import sys
import os
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):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
......@@ -44,6 +48,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()
......@@ -70,14 +81,14 @@ class TDTestCase:
os.system("rm /tmp/*.sql")
os.system("rm /tmp/*.avro*")
os.system(
"%staosdump --databases db -o /tmp -B 16384" %
"%staosdump --databases db -o /tmp -B 16384 -y" %
binPath)
tdSql.execute("drop database db")
tdSql.query("show databases")
tdSql.checkRows(0)
os.system("%staosdump -i /tmp" % binPath)
os.system("%staosdump -i /tmp -y" % binPath)
tdSql.query("show databases")
tdSql.checkRows(1)
......@@ -91,6 +102,32 @@ class TDTestCase:
tdSql.query("select count(*) from t1")
tdSql.checkData(0, 0, self.numberOfRecords)
# 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()
tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册