diff --git a/tests/army/query/window/base.py b/tests/army/query/window/base.py new file mode 100644 index 0000000000..c5be1207b5 --- /dev/null +++ b/tests/army/query/window/base.py @@ -0,0 +1,48 @@ +################################################################### +# Copyright (c) 2016 by TAOS Technologies, Inc. +# All rights reserved. +# +# This file is proprietary and confidential to TAOS Technologies. +# No part of this file may be reproduced, stored, transmitted, +# disclosed or used in any form or by any means other than as +# expressly provided by the written permission from Jianhui Tao +# +################################################################### + +# -*- coding: utf-8 -*- +from frame.log import * +from frame.cases import * +from frame.sql import * +from frame import etool + + +class TDTestCase: + # init + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), True) + # taosBenchmark run + tdLog.info(f"insert data.") + jfile = etool.curFile(__file__, "window.json") + etool.benchMark(json=jfile) + + # run + def run(self): + # TD-31660 + sql = "select _wstart,_wend,count(voltage),tbname from db.stb partition by tbname event_window start with voltage >2 end with voltage > 15 slimit 5 limit 5" + tdSql.query(sql) + tdSql.checkRows(25) + sql = "select _wstart,_wend,count(voltage),tbname from db.stb partition by tbname count_window(600) slimit 5 limit 5;" + tdSql.query(sql) + tdSql.checkRows(25) + + # stop + def stop(self): + tdSql.execute("drop database db;") + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/army/query/window/window.json b/tests/army/query/window/window.json new file mode 100644 index 0000000000..8d3f0ae328 --- /dev/null +++ b/tests/army/query/window/window.json @@ -0,0 +1,123 @@ +{ + "filetype": "insert", + "cfgdir": "/etc/taos", + "host": "127.0.0.1", + "port": 6030, + "user": "root", + "password": "taosdata", + "connection_pool_size": 8, + "num_of_records_per_req": 4000, + "prepared_rand": 10000, + "thread_count": 3, + "create_table_thread_count": 1, + "confirm_parameter_prompt": "no", + "databases": [ + { + "dbinfo": { + "name": "db", + "drop": "yes", + "vgroups": 3, + "replica": 1, + "duration": "3d", + "wal_retention_period": 1, + "wal_retention_size": 1, + "stt_trigger": 1 + }, + "super_tables": [ + { + "name": "stb", + "child_table_exists": "no", + "childtable_count": 6, + "insert_rows": 100000, + "childtable_prefix": "d", + "insert_mode": "taosc", + "timestamp_step": 30000, + "start_timestamp": 1700000000000, + "columns": [ + { + "type": "bool", + "name": "bc" + }, + { + "type": "float", + "name": "fc" + }, + { + "type": "double", + "name": "voltage", + "max": 250, + "min": 200 + }, + { + "type": "tinyint", + "name": "ti" + }, + { + "type": "smallint", + "name": "si" + }, + { + "type": "int", + "name": "ic" + }, + { + "type": "bigint", + "name": "bi" + }, + { + "type": "utinyint", + "name": "uti" + }, + { + "type": "usmallint", + "name": "usi" + }, + { + "type": "uint", + "name": "ui" + }, + { + "type": "ubigint", + "name": "ubi" + }, + { + "type": "binary", + "name": "bin", + "len": 8 + }, + { + "type": "nchar", + "name": "nch", + "len": 16 + } + ], + "tags": [ + { + "type": "tinyint", + "name": "groupid", + "max": 10, + "min": 1 + }, + { + "name": "location", + "type": "binary", + "len": 16, + "values": [ + "San Francisco", + "Los Angles", + "San Diego", + "San Jose", + "Palo Alto", + "Campbell", + "Mountain View", + "Sunnyvale", + "Santa Clara", + "Cupertino" + ] + } + ] + } + ] + } + ] +} diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 8dfb6f6a00..7ec891ae73 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -41,6 +41,7 @@ ,,y,army,./pytest.sh python3 ./test.py -f tmq/tmqBugs.py -N 3 ,,y,army,./pytest.sh python3 ./test.py -f query/fill/fill_compare_asc_desc.py ,,y,army,./pytest.sh python3 ./test.py -f query/last/test_last.py +,,y,army,./pytest.sh python3 ./test.py -f query/window/base.py # # system test