From 60865ba62d2947cc1635cac57a5d6ac51230ad0a Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Fri, 19 Nov 2021 17:57:15 +0800 Subject: [PATCH] [TS-561][TS-646]: add test case --- tests/pytest/query/queryGroupTbname.py | 23 +++++++++++++++++++++++ tests/pytest/stable/insert.py | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/tests/pytest/query/queryGroupTbname.py b/tests/pytest/query/queryGroupTbname.py index 90e7175082..bb67809e60 100644 --- a/tests/pytest/query/queryGroupTbname.py +++ b/tests/pytest/query/queryGroupTbname.py @@ -10,6 +10,7 @@ ################################################################### # -*- coding: utf-8 -*- +from util.dnodes import tdDnodes from util.log import tdLog from util.cases import tdCases from util.sql import tdSql @@ -71,6 +72,28 @@ class TDTestCase: tdSql.query("select last_row(*), tbname from meters group by tbname order by ts desc") tdSql.checkRows(2) + # TS-561 null tags group by crash + tdLog.info("test case for TS-561") + tdSql.execute("create database openfalcon") + tdSql.execute("use openfalcon") + tdSql.execute("create table stb (ts timestamp, value double) tags(_endpoint binary(150), _hostname binary(150), _indexname binary(50), _ip binary(50), _q_name binary(150))") + tdSql.execute("create table tb0 using stb tags('root.FTBI', 'CNSZ17VL4774', 'max_mem', '10.116.100.10_8088', 'root.line_volume_predict')") + tdSql.execute("create table tb1 using stb(_endpoint, _hostname, _indexname) tags('root.medium_high_freq', 'CNSZ17VL4775', 'max_mem_1')") + + for i in range(2): + sql = "insert into tb%d values" % i + for j in range(10000): + sql += "(%d, %d)" % (ts + j * 500, random.randint(1, 10000) + random.uniform(1.0, 1000.0)) + tdSql.execute(sql) + + tdSql.query("select avg(value) from openfalcon.stb where ts > '2020-11-15 03:30:00.000' and ts < '2020-11-15 04:30:00.000' group by _hostname, _indexname, _ip, _q_name") + tdSql.checkRows(2) + + tdDnodes.stop(1) + tdDnodes.start(1) + + tdSql.query("select avg(value) from openfalcon.stb where ts > '2020-11-15 03:30:00.000' and ts < '2020-11-15 04:30:00.000' group by _hostname, _indexname, _ip, _q_name") + tdSql.checkRows(2) def run(self): tdSql.prepare() diff --git a/tests/pytest/stable/insert.py b/tests/pytest/stable/insert.py index ef5635c77c..f46a6bcf4a 100644 --- a/tests/pytest/stable/insert.py +++ b/tests/pytest/stable/insert.py @@ -91,6 +91,12 @@ class TDTestCase: tdSql.query("show stables") tdSql.checkRows(1) + # TS-646 + tdLog.info("test case for TS-646") + tdSql.execute("drop stable if exists db.st") + tdSql.execute("create table stb(ts timestamp, c1 int) tags(t1 int)") + tdSql.error("create table `` using stb tags(1)") + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) -- GitLab