From 811a32dcd995f5ba47a809756fc41ff7b81b40e9 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 29 Nov 2021 17:51:09 +0800 Subject: [PATCH] fix error --- deps/avro | 1 + deps/googletest | 1 + deps/rocksdb | 1 + deps/zlib | 1 + src/connector/go | 2 +- src/connector/grafanaplugin | 2 +- src/connector/hivemq-tdengine-extension | 2 +- src/plugins/blm3 | 1 + src/plugins/taosadapter | 1 + tests/pytest/tools/windows_input.py | 2 +- tests/pytest/tt.py | 125 ++++++++++++++++++++++++ 11 files changed, 135 insertions(+), 4 deletions(-) create mode 160000 deps/avro create mode 160000 deps/googletest create mode 160000 deps/rocksdb create mode 160000 deps/zlib create mode 160000 src/plugins/blm3 create mode 160000 src/plugins/taosadapter create mode 100644 tests/pytest/tt.py diff --git a/deps/avro b/deps/avro new file mode 160000 index 0000000000..a1fce29d96 --- /dev/null +++ b/deps/avro @@ -0,0 +1 @@ +Subproject commit a1fce29d9675b4dd95dfee9db32cc505d0b2227c diff --git a/deps/googletest b/deps/googletest new file mode 160000 index 0000000000..e2239ee604 --- /dev/null +++ b/deps/googletest @@ -0,0 +1 @@ +Subproject commit e2239ee6043f73722e7aa812a459f54a28552929 diff --git a/deps/rocksdb b/deps/rocksdb new file mode 160000 index 0000000000..c3034fce32 --- /dev/null +++ b/deps/rocksdb @@ -0,0 +1 @@ +Subproject commit c3034fce329017036c807e01261729bfc11a5d62 diff --git a/deps/zlib b/deps/zlib new file mode 160000 index 0000000000..cacf7f1d4e --- /dev/null +++ b/deps/zlib @@ -0,0 +1 @@ +Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f diff --git a/src/connector/go b/src/connector/go index 050667e5b4..b8f76da4a7 160000 --- a/src/connector/go +++ b/src/connector/go @@ -1 +1 @@ -Subproject commit 050667e5b4d0eafa5387e4283e713559b421203f +Subproject commit b8f76da4a708d158ec3cc4b844571dc4414e36b4 diff --git a/src/connector/grafanaplugin b/src/connector/grafanaplugin index 72ecc6d636..792ef7c303 160000 --- a/src/connector/grafanaplugin +++ b/src/connector/grafanaplugin @@ -1 +1 @@ -Subproject commit 72ecc6d636453c6a9b71d78d3edce385165cc35f +Subproject commit 792ef7c3036f15068796e09883d3f4d47a038fe2 diff --git a/src/connector/hivemq-tdengine-extension b/src/connector/hivemq-tdengine-extension index b62a26ecc1..ce52010141 160000 --- a/src/connector/hivemq-tdengine-extension +++ b/src/connector/hivemq-tdengine-extension @@ -1 +1 @@ -Subproject commit b62a26ecc164a310104df57691691b237e091c89 +Subproject commit ce5201014136503d34fecbd56494b67b4961056c diff --git a/src/plugins/blm3 b/src/plugins/blm3 new file mode 160000 index 0000000000..f56aa0f485 --- /dev/null +++ b/src/plugins/blm3 @@ -0,0 +1 @@ +Subproject commit f56aa0f485d7bb6aebbcefc2007eeecdccb767c8 diff --git a/src/plugins/taosadapter b/src/plugins/taosadapter new file mode 160000 index 0000000000..6397bf5963 --- /dev/null +++ b/src/plugins/taosadapter @@ -0,0 +1 @@ +Subproject commit 6397bf5963f62f0aa5c4b9b961b16ed5c62579f1 diff --git a/tests/pytest/tools/windows_input.py b/tests/pytest/tools/windows_input.py index fa705ac3b1..72f50a5acf 100644 --- a/tests/pytest/tools/windows_input.py +++ b/tests/pytest/tools/windows_input.py @@ -52,7 +52,7 @@ class TDTestCase: temp = '' for i in range(300): temp += 'a' - sql = "insert into db.tb values(now,'%s')" % temp + sql = "insert into db.tb values(now,'%s');" % temp window.SendKeys(sql) window.SendKeys('{Enter}') window.SendKeys('{Ctrl}C') diff --git a/tests/pytest/tt.py b/tests/pytest/tt.py new file mode 100644 index 0000000000..313a48c96b --- /dev/null +++ b/tests/pytest/tt.py @@ -0,0 +1,125 @@ +################################################################### +# 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 -*- +import threading +import taos +import sys +import json +import time +import random +import requests +import argparse +import datetime +import string +from requests.auth import HTTPBasicAuth + +class CompressTest: + # def __init__(self,ts=1500000001000,host='127.0.0.1',user='root',password='taosdata',dbname='test', + # stb_prefix='st',subtb_prefix='t',n_Therads=10,r_Therads=10,probabilities=0.05,loop=5, + # stableNum = 2,subtableNum = 1000,insertRows = 100): + def __init__(self): + self.host = 'vm95' + self.ts = 1569859200000 + self.dbname = 'db' + self.user = 'root' + self.password = 'taosdata' + self.loop = 6 + + def rest_query(self,sql): #rest 接口 + host = self.host + user = self.user + password = self.password + port =6041 + url = "http://{}:{}/rest/sql".format(host, port ) + try: + r = requests.post(url, + data = 'use %s' % self.dbname, + auth = HTTPBasicAuth('root', 'taosdata')) + r = requests.post(url, + data = sql, + auth = HTTPBasicAuth('root', 'taosdata')) + except: + print("REST API Failure (TODO: more info here)") + raise + rj = r.json() + if ('status' not in rj): + raise RuntimeError("No status in REST response") + + if rj['status'] == 'error': # clearly reported error + if ('code' not in rj): # error without code + raise RuntimeError("REST error return without code") + errno = rj['code'] # May need to massage this in the future + # print("Raising programming error with REST return: {}".format(rj)) + raise taos.error.ProgrammingError( + rj['desc'], errno) # todo: check existance of 'desc' + + if rj['status'] != 'succ': # better be this + raise RuntimeError( + "Unexpected REST return status: {}".format( + rj['status'])) + + nRows = rj['rows'] if ('rows' in rj) else 0 + return nRows + + + def query_thread_n(self,threadID): #使用原生python接口查询 + tstart = time.time() + host = self.host + user = self.user + password = self.password + conn = taos.connect( + host, + user, + password, + ) + cl = conn.cursor() + cl.execute("use %s;" % self.dbname) + print("Thread %d: starting" % threadID) + loop = self.loop + for loop in range(7): + ts = 1569859200000+loop*86400000 + try: + # sql = 'select ts,c0 from stb_%d where ts >%d and ts <%d' % (threadID, ts, ts+86400000) + sql = 'select ts,c1 from stb_%d where ts >%d and ts <%d' % (threadID, ts, ts+86400000) + # print("sql is ",sql) + # start = time.time() + cl.execute(sql) + cl.fetchall() + # end = time.time() + # print("time cost :",end-start) + except Exception as e: + print('-'*40) + print( + "Failure thread%d, sql: %s \nexception: %s" % + (threadID, str(sql),str(e))) + err_uec='Unable to establish connection' + if err_uec in str(e) and loop >0: + exit(-1) + cl.close() + conn.close() + tstop = time.time() + print("Thread %d: finishing, time collaps:%d " % (threadID, tstop - tstart)) + + + def run(self): + threads = [] + for i in range(10): + thread = threading.Thread(target=self.query_thread_n, args=(i,)) + threads.append(thread) + thread.start() + # for i in range(1,11): + # thread = threading.Thread(target=self.query_thread_r, args=(i,)) + # threads.append(thread) + # thread.start() + +q = CompressTest() +q.run() -- GitLab