未验证 提交 eea679a7 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #8833 from taosdata/test/windows_input_too_long

[TS-748]<test>fix windows input limit
avro @ a1fce29d
Subproject commit a1fce29d9675b4dd95dfee9db32cc505d0b2227c
googletest @ e2239ee6
Subproject commit e2239ee6043f73722e7aa812a459f54a28552929
rocksdb @ c3034fce
Subproject commit c3034fce329017036c807e01261729bfc11a5d62
zlib @ cacf7f1d
Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f
Subproject commit 050667e5b4d0eafa5387e4283e713559b421203f
Subproject commit b8f76da4a708d158ec3cc4b844571dc4414e36b4
Subproject commit 72ecc6d636453c6a9b71d78d3edce385165cc35f
Subproject commit 792ef7c3036f15068796e09883d3f4d47a038fe2
Subproject commit b62a26ecc164a310104df57691691b237e091c89
Subproject commit ce5201014136503d34fecbd56494b67b4961056c
blm3 @ f56aa0f4
Subproject commit f56aa0f485d7bb6aebbcefc2007eeecdccb767c8
taosadapter @ 6397bf59
Subproject commit 6397bf5963f62f0aa5c4b9b961b16ed5c62579f1
......@@ -18,4 +18,5 @@ python .\test.py -f query\filterAllIntTypes.py
python .\test.py -f query\filterFloatAndDouble.py
python .\test.py -f query\filterOtherTypes.py
python .\test.py -f query\querySort.py
python .\test.py -f query\queryJoin.py
\ No newline at end of file
python .\test.py -f query\queryJoin.py
python .\test.py -f tools\windows_input.py
\ No newline at end of file
###################################################################
# 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 os
from uiautomation import WindowControl
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.host = conn._host
def win_input_test(self):
os.system("start")
time.sleep(1)
# 获取CMD窗口
# window = DocumentControl(searchDepth=3, Name='Text Area')
window = WindowControl(searchDepth=1, AutomationId='Console Window')
# 切换英文输入法
# window.SendKeys('\\')
# window.SendKeys('{Enter}')
# window.SendKeys('{Shift}')
# window.SendKeys('\\')
# window.SendKeys('{Enter}')
# 切换目录
window.SendKeys('c:')
window.SendKeys('{Enter}')
window.SendKeys('cd \\')
window.SendKeys('{Enter}')
window.SendKeys('cd c:\\TDengine')
window.SendKeys('{Enter}')
# 启动taos.exe
window.SendKeys('taos.exe -h %s || taos.exe' % (self.host))
window.SendKeys('{Enter}')
# 输入
temp = ''
for i in range(300):
temp += 'a'
sql = "insert into db.tb values(now,'%s');" % temp
window.SendKeys(sql)
window.SendKeys('{Enter}')
window.SendKeys('{Ctrl}C')
window.SendKeys('exit')
window.SendKeys('{Enter}')
def run(self):
tdSql.prepare()
ret = tdSql.execute('create table tb (ts timestamp, i binary(300))')
self.win_input_test()
tdSql.query("select * from tb")
tdSql.checkRows(1)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# 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()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册