diff --git a/tests/system-test/0-others/taosdShell.py b/tests/system-test/0-others/taosdShell.py index 6d62420efe..e09c8edce9 100644 --- a/tests/system-test/0-others/taosdShell.py +++ b/tests/system-test/0-others/taosdShell.py @@ -14,6 +14,7 @@ from util.log import * from util.sql import * from util.cases import * from util.dnodes import * +from util.cluster import * class TDTestCase: #updatecfgDict = {'clientCfg': {'serverPort': 7080, 'firstEp': 'trd02:7080', 'secondEp':'trd02:7080'},\ @@ -106,12 +107,39 @@ class TDTestCase: tdLog.printNoPrefix("%s"%taosdCmd) os.system(f"{taosdCmd}") - def run(self): - tdSql.prepare() - # time.sleep(2) - tdSql.query("create user testpy pass 'testpy'") + def preData(self): + # database\stb\tb\chiild-tb\rows\topics + tdSql.execute("create user testpy pass 'testpy'") + tdSql.execute("drop database if exists db0;") + tdSql.execute("create database db0;") + tdSql.execute("use db0;") + tdSql.execute("create table if not exists db0.stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned);") + tdSql.execute("create table db0.ct1 using db0.stb tags(1000);") + tdSql.execute("create table db0.ct2 using db0.stb tags(2000);") + tdSql.execute("create table if not exists db0.ntb (ts timestamp, c1 int, c2 float, c3 double) ;") + tdSql.query("show db0.stables;") + tdSql.execute("insert into db0.ct1 values(now+0s, 10, 2.0, 3.0);") + tdSql.execute("insert into db0.ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, 12, 2.2, 3.2)(now+3s, 13, 2.3, 3.3);") + tdSql.execute("insert into db0.ntb values(now+2s, 10, 2.0, 3.0);") + tdSql.execute("create sma index sma_index_name1 on db0.stb function(max(c1),max(c2),min(c1)) interval(6m,10s) sliding(6m);") + tdSql.execute("create topic tpc1 as select * from db0.ct2; ") - #hostname = socket.gethostname() + + #stream + tdSql.execute("drop database if exists source_db;") + tdSql.query("create database source_db vgroups 3;") + tdSql.query("use source_db") + tdSql.query("create table if not exists source_db.stb (ts timestamp, k int) tags (a int);") + tdSql.query("create table source_db.ct1 using source_db.stb tags(1000);create table source_db.ct2 using source_db.stb tags(2000);create table source_db.ct3 using source_db.stb tags(3000);") + tdSql.query("create stream s1 into source_db.output_stb as select _wstart AS start, min(k), max(k), sum(k) from source_db.stb interval(10m);") + + + + + def run(self): + # tdSql.prepare() + # time.sleep(2) + self.preData() #tdLog.info ("hostname: %s" % hostname) buildPath = self.getBuildPath() @@ -128,7 +156,15 @@ class TDTestCase: # keyDict['h'] = self.hostname # keyDict['c'] = cfgPath # keyDict['P'] = self.serverPort - tdDnodes.stop(1) + tdDnodes=cluster.dnodes + for i in range(5): + tdDnodes[i].stoptaosd() + + + startAction = " -s -c " + taosdCfgPath + tdLog.printNoPrefix("================================ parameter: %s"%startAction) + self.taosdCommandExe(startAction,taosdCmdRun) + startAction = " --help" tdLog.printNoPrefix("================================ parameter: %s"%startAction) @@ -153,9 +189,7 @@ class TDTestCase: tdLog.printNoPrefix("================================ parameter: %s"%startAction) self.taosdCommandStop(startAction,taosdCmdRun) - startAction = " -s" - tdLog.printNoPrefix("================================ parameter: %s"%startAction) - self.taosdCommandExe(startAction,taosdCmdRun) + startAction = " -e TAOS_QUERY_POLICY=2 " tdLog.printNoPrefix("================================ parameter: %s"%startAction) diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index b895a1bf19..d57f682b40 100644 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -13,7 +13,7 @@ python3 ./test.py -f 0-others/udf_restart_taosd.py python3 ./test.py -f 0-others/cachemodel.py python3 ./test.py -f 0-others/udf_cfg1.py python3 ./test.py -f 0-others/udf_cfg2.py - +python3 ./test.py -f 0-others/taosdShell.py -N 5 -M 3 -Q 3 python3 ./test.py -f 0-others/sysinfo.py python3 ./test.py -f 0-others/user_control.py python3 ./test.py -f 0-others/fsync.py @@ -363,7 +363,7 @@ python3 ./test.py -f 2-query/concat.py -Q 2 python3 ./test.py -f 2-query/concat2.py -Q 2 python3 ./test.py -f 2-query/concat_ws.py -Q 2 python3 ./test.py -f 2-query/concat_ws2.py -Q 2 -#python3 ./test.py -f 2-query/check_tsdb.py -Q 2 +python3 ./test.py -f 2-query/check_tsdb.py -Q 2 python3 ./test.py -f 2-query/spread.py -Q 2 python3 ./test.py -f 2-query/hyperloglog.py -Q 2 python3 ./test.py -f 2-query/explain.py -Q 2 @@ -402,13 +402,17 @@ python3 ./test.py -f 2-query/arctan.py -Q 2 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2 python3 ./test.py -f 2-query/interp.py -Q 2 -# python3 ./test.py -f 2-query/nestedQuery.py -Q 2 -# python3 ./test.py -f 2-query/nestedQuery_str.py -Q 2 +python3 ./test.py -f 2-query/nestedQuery.py -Q 2 +python3 ./test.py -f 2-query/nestedQuery_str.py -Q 2 +python3 ./test.py -f 2-query/nestedQuery_math.py -Q 2 +python3 ./test.py -f 2-query/nestedQuery_time.py -Q 2 +python3 ./test.py -f 2-query/stablity.py -Q 2 +python3 ./test.py -f 2-query/stablity_1.py -Q 2 python3 ./test.py -f 2-query/avg.py -Q 2 -# python3 ./test.py -f 2-query/elapsed.py -Q 2 +python3 ./test.py -f 2-query/elapsed.py -Q 2 python3 ./test.py -f 2-query/csum.py -Q 2 -#python3 ./test.py -f 2-query/mavg.py -Q 2 +python3 ./test.py -f 2-query/mavg.py -Q 2 python3 ./test.py -f 2-query/sample.py -Q 2 python3 ./test.py -f 2-query/function_diff.py -Q 2 python3 ./test.py -f 2-query/unique.py -Q 2 @@ -432,8 +436,9 @@ python3 ./test.py -f 2-query/count_partition.py -Q 2 python3 ./test.py -f 2-query/max_partition.py -Q 2 python3 ./test.py -f 2-query/last_row.py -Q 2 python3 ./test.py -f 2-query/tsbsQuery.py -Q 2 -#------------querPolicy 3----------- +python3 ./test.py -f 2-query/sml.py -Q 2 +#------------querPolicy 3----------- python3 ./test.py -f 2-query/between.py -Q 3 python3 ./test.py -f 2-query/distinct.py -Q 3 python3 ./test.py -f 2-query/varchar.py -Q 3 @@ -453,7 +458,7 @@ python3 ./test.py -f 2-query/concat.py -Q 3 python3 ./test.py -f 2-query/concat2.py -Q 3 python3 ./test.py -f 2-query/concat_ws.py -Q 3 python3 ./test.py -f 2-query/concat_ws2.py -Q 3 -#python3 ./test.py -f 2-query/check_tsdb.py -Q 3 +python3 ./test.py -f 2-query/check_tsdb.py -Q 3 python3 ./test.py -f 2-query/spread.py -Q 3 python3 ./test.py -f 2-query/hyperloglog.py -Q 3 python3 ./test.py -f 2-query/explain.py -Q 3 @@ -464,7 +469,7 @@ python3 ./test.py -f 2-query/Today.py -Q 3 python3 ./test.py -f 2-query/max.py -Q 3 python3 ./test.py -f 2-query/min.py -Q 3 python3 ./test.py -f 2-query/count.py -Q 3 -#python3 ./test.py -f 2-query/last.py -Q 3 +python3 ./test.py -f 2-query/last.py -Q 3 python3 ./test.py -f 2-query/first.py -Q 3 python3 ./test.py -f 2-query/To_iso8601.py -Q 3 python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 3 @@ -490,12 +495,18 @@ python3 ./test.py -f 2-query/arcsin.py -Q 3 python3 ./test.py -f 2-query/arccos.py -Q 3 python3 ./test.py -f 2-query/arctan.py -Q 3 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3 -# python3 ./test.py -f 2-query/nestedQuery.py -Q 3 -# python3 ./test.py -f 2-query/nestedQuery_str.py -Q 3 -# python3 ./test.py -f 2-query/avg.py -Q 3 -# python3 ./test.py -f 2-query/elapsed.py -Q 3 + +python3 ./test.py -f 2-query/nestedQuery.py -Q 3 +python3 ./test.py -f 2-query/nestedQuery_str.py -Q 3 +python3 ./test.py -f 2-query/nestedQuery_math.py -Q 3 +python3 ./test.py -f 2-query/nestedQuery_time.py -Q 3 +python3 ./test.py -f 2-query/stablity.py -Q 3 +python3 ./test.py -f 2-query/stablity_1.py -Q 3 + +python3 ./test.py -f 2-query/avg.py -Q 3 +python3 ./test.py -f 2-query/elapsed.py -Q 3 python3 ./test.py -f 2-query/csum.py -Q 3 -#python3 ./test.py -f 2-query/mavg.py -Q 3 +python3 ./test.py -f 2-query/mavg.py -Q 3 python3 ./test.py -f 2-query/sample.py -Q 3 python3 ./test.py -f 2-query/function_diff.py -Q 3 python3 ./test.py -f 2-query/unique.py -Q 3 @@ -544,7 +555,7 @@ python3 ./test.py -f 2-query/concat.py -Q 4 python3 ./test.py -f 2-query/concat2.py -Q 4 python3 ./test.py -f 2-query/concat_ws.py -Q 4 python3 ./test.py -f 2-query/concat_ws2.py -Q 4 -#python3 ./test.py -f 2-query/check_tsdb.py -Q 4 +python3 ./test.py -f 2-query/check_tsdb.py -Q 4 python3 ./test.py -f 2-query/spread.py -Q 4 python3 ./test.py -f 2-query/hyperloglog.py -Q 4 python3 ./test.py -f 2-query/explain.py -Q 4 @@ -555,7 +566,7 @@ python3 ./test.py -f 2-query/Today.py -Q 4 python3 ./test.py -f 2-query/max.py -Q 4 python3 ./test.py -f 2-query/min.py -Q 4 python3 ./test.py -f 2-query/count.py -Q 4 -#python3 ./test.py -f 2-query/last.py -Q 4 +python3 ./test.py -f 2-query/last.py -Q 4 python3 ./test.py -f 2-query/first.py -Q 4 python3 ./test.py -f 2-query/To_iso8601.py -Q 4 python3 ./test.py -f 2-query/To_unixtimestamp.py -Q 4 @@ -581,12 +592,19 @@ python3 ./test.py -f 2-query/arcsin.py -Q 4 python3 ./test.py -f 2-query/arccos.py -Q 4 python3 ./test.py -f 2-query/arctan.py -Q 4 python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 4 -# python3 ./test.py -f 2-query/nestedQuery.py -Q 4 -# python3 ./test.py -f 2-query/nestedQuery_str.py -Q 4 -# python3 ./test.py -f 2-query/avg.py -Q 4 -# python3 ./test.py -f 2-query/elapsed.py -Q 4 + +#python3 ./test.py -f 2-query/nestedQuery.py -Q 4 +python3 ./test.py -f 2-query/nestedQuery_str.py -Q 4 +python3 ./test.py -f 2-query/nestedQuery_math.py -Q 4 +python3 ./test.py -f 2-query/nestedQuery_time.py -Q 4 +python3 ./test.py -f 2-query/stablity.py -Q 4 +python3 ./test.py -f 2-query/stablity_1.py -Q 4 + + +python3 ./test.py -f 2-query/avg.py -Q 4 +python3 ./test.py -f 2-query/elapsed.py -Q 4 python3 ./test.py -f 2-query/csum.py -Q 4 -#python3 ./test.py -f 2-query/mavg.py -Q 4 +python3 ./test.py -f 2-query/mavg.py -Q 4 python3 ./test.py -f 2-query/sample.py -Q 4 python3 ./test.py -f 2-query/function_diff.py -Q 4 python3 ./test.py -f 2-query/unique.py -Q 4 @@ -610,5 +628,5 @@ python3 ./test.py -f 2-query/count_partition.py -Q 4 python3 ./test.py -f 2-query/max_partition.py -Q 4 python3 ./test.py -f 2-query/last_row.py -Q 4 python3 ./test.py -f 2-query/tsbsQuery.py -Q 4 -#python3 ./test.py -f 2-query/sml.py -Q 4 +python3 ./test.py -f 2-query/sml.py -Q 4 python3 ./test.py -f 2-query/interp.py -Q 4 diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 2f482e4277..dd49f037bd 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -321,7 +321,7 @@ if __name__ == "__main__": for dnode in tdDnodes.dnodes: tdDnodes.starttaosd(dnode.index) tdCases.logSql(logSql) - + if restful: tAdapter.deploy(adapter_cfg_dict) tAdapter.start() @@ -341,6 +341,26 @@ if __name__ == "__main__": print("check dnode ready") except Exception as r: print(r) + if queryPolicy != 1: + queryPolicy=int(queryPolicy) + if restful: + conn = taosrest.connect(url=f"http://{host}:6041") + else: + conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) + + cursor = conn.cursor() + cursor.execute("create qnode on dnode 1") + cursor.execute(f'alter local "queryPolicy" "{queryPolicy}"') + cursor.execute("show local variables") + res = cursor.fetchall() + for i in range(cursor.rowcount): + if res[i][0] == "queryPolicy" : + if int(res[i][1]) == int(queryPolicy): + tdLog.success(f'alter queryPolicy to {queryPolicy} successfully') + else: + tdLog.debug(res) + tdLog.exit(f"alter queryPolicy to {queryPolicy} failed") + if ucase is not None and hasattr(ucase, 'noConn') and ucase.noConn == True: conn = None else: @@ -455,6 +475,26 @@ if __name__ == "__main__": except Exception as r: print(r) + if queryPolicy != 1: + queryPolicy=int(queryPolicy) + if restful: + conn = taosrest.connect(url=f"http://{host}:6041") + else: + conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) + + cursor = conn.cursor() + cursor.execute("create qnode on dnode 1") + cursor.execute(f'alter local "queryPolicy" "{queryPolicy}"') + cursor.execute("show local variables") + res = cursor.fetchall() + for i in range(cursor.rowcount): + if res[i][0] == "queryPolicy" : + if int(res[i][1]) == int(queryPolicy): + tdLog.success(f'alter queryPolicy to {queryPolicy} successfully') + else: + tdLog.debug(res) + tdLog.exit(f"alter queryPolicy to {queryPolicy} failed") + if testCluster: tdLog.info("Procedures for testing cluster")