[TD-6289]<test> :modify case codes!
This commit is contained in:
parent
47f39f45ab
commit
00a07ec721
|
@ -22,8 +22,6 @@ from util.log import *
|
||||||
from util.cases import *
|
from util.cases import *
|
||||||
from util.sql import *
|
from util.sql import *
|
||||||
import time, datetime
|
import time, datetime
|
||||||
|
|
||||||
|
|
||||||
import requests, json
|
import requests, json
|
||||||
import threading
|
import threading
|
||||||
import string
|
import string
|
||||||
|
@ -98,37 +96,28 @@ class TDTestCase():
|
||||||
"select * from tb",
|
"select * from tb",
|
||||||
"select * from test.tb"]
|
"select * from test.tb"]
|
||||||
|
|
||||||
|
|
||||||
for sql in sqls:
|
for sql in sqls:
|
||||||
print("===================")
|
print("===================")
|
||||||
check_unbind_db(url,sql,header)
|
check_unbind_db(url,sql,header)
|
||||||
|
|
||||||
print("==================="*5)
|
print("==================="*5)
|
||||||
|
|
||||||
print(" check bind db about restful ")
|
print(" check bind db about restful ")
|
||||||
|
|
||||||
print("==================="*5)
|
print("==================="*5)
|
||||||
|
|
||||||
url = "http://127.0.0.1:6041/rest/sql/des"
|
url = "http://127.0.0.1:6041/rest/sql/des"
|
||||||
for sql in sqls:
|
for sql in sqls:
|
||||||
print("===================")
|
print("===================")
|
||||||
check_bind_db(url,sql,header)
|
check_bind_db(url,sql,header)
|
||||||
|
|
||||||
# check data
|
# check data
|
||||||
|
|
||||||
tdSql.query("select * from test.tb")
|
tdSql.query("select * from test.tb")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.query("select * from des.tb")
|
tdSql.query("select * from des.tb")
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
os.system('sudo timedatectl set-ntp on')
|
os.system('sudo timedatectl set-ntp on')
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success("%s successfully executed" % __file__)
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
tdCases.addWindows(__file__, TDTestCase())
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
tdCases.addLinux(__file__, TDTestCase())
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -22,14 +22,11 @@ from util.log import *
|
||||||
from util.cases import *
|
from util.cases import *
|
||||||
from util.sql import *
|
from util.sql import *
|
||||||
import time, datetime
|
import time, datetime
|
||||||
|
|
||||||
|
|
||||||
import requests, json
|
import requests, json
|
||||||
import threading
|
import threading
|
||||||
import string
|
import string
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
||||||
def check_res(url, data, header):
|
def check_res(url, data, header):
|
||||||
resp = requests.post(url, data, headers = header )
|
resp = requests.post(url, data, headers = header )
|
||||||
resp.encoding='utf-8'
|
resp.encoding='utf-8'
|
||||||
|
@ -50,7 +47,6 @@ class TDTestCase():
|
||||||
tdLog.debug("start to execute %s" % __file__)
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
tdSql.init(conn.cursor(), logSql)
|
tdSql.init(conn.cursor(), logSql)
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
tdSql.execute('reset query cache')
|
tdSql.execute('reset query cache')
|
||||||
|
@ -59,7 +55,6 @@ class TDTestCase():
|
||||||
tdSql.execute('drop database if exists des')
|
tdSql.execute('drop database if exists des')
|
||||||
tdSql.execute('create database test')
|
tdSql.execute('create database test')
|
||||||
tdSql.execute('create database des')
|
tdSql.execute('create database des')
|
||||||
|
|
||||||
header = {'Authorization': 'Basic cm9vdDp0YW9zZGF0YQ=='}
|
header = {'Authorization': 'Basic cm9vdDp0YW9zZGF0YQ=='}
|
||||||
url = "http://127.0.0.1:6041/rest/sql/"
|
url = "http://127.0.0.1:6041/rest/sql/"
|
||||||
|
|
||||||
|
@ -87,8 +82,6 @@ class TDTestCase():
|
||||||
"select * from test.tb",
|
"select * from test.tb",
|
||||||
"create table des.tb (ts timestamp, id int , data double)",
|
"create table des.tb (ts timestamp, id int , data double)",
|
||||||
"insert into des.tb values (now , 3, 3.0)"]
|
"insert into des.tb values (now , 3, 3.0)"]
|
||||||
|
|
||||||
|
|
||||||
for sql in sqls:
|
for sql in sqls:
|
||||||
print("===================")
|
print("===================")
|
||||||
if sql == "create table test.tb (ts timestamp, id int , data double)":
|
if sql == "create table test.tb (ts timestamp, id int , data double)":
|
||||||
|
@ -103,14 +96,10 @@ class TDTestCase():
|
||||||
tdSql.query("select * from des.tb")
|
tdSql.query("select * from des.tb")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
|
|
||||||
print("==================="*5)
|
print("==================="*5)
|
||||||
|
|
||||||
print(" check bind db about restful ")
|
print(" check bind db about restful ")
|
||||||
|
|
||||||
print("==================="*5)
|
print("==================="*5)
|
||||||
|
|
||||||
|
|
||||||
tdSql.execute('reset query cache')
|
tdSql.execute('reset query cache')
|
||||||
tdSql.execute('drop database if exists test')
|
tdSql.execute('drop database if exists test')
|
||||||
tdSql.execute('drop database if exists db')
|
tdSql.execute('drop database if exists db')
|
||||||
|
@ -127,34 +116,12 @@ class TDTestCase():
|
||||||
print ("%s run occur error as expect ,check pass!" %(sql))
|
print ("%s run occur error as expect ,check pass!" %(sql))
|
||||||
else:
|
else:
|
||||||
check_res(url,sql,header)
|
check_res(url,sql,header)
|
||||||
|
|
||||||
# check data
|
# check data
|
||||||
|
|
||||||
tdSql.query("select * from test.tb")
|
tdSql.query("select * from test.tb")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.query("select * from des.tb")
|
tdSql.query("select * from des.tb")
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# curl(url ,data , header)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# threads = []
|
|
||||||
# for i in range(self.numOfThreads):
|
|
||||||
# thread = threading.Thread(target=self.insertData, args=(i,))
|
|
||||||
# thread.start()
|
|
||||||
# threads.append(thread)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
os.system('sudo timedatectl set-ntp on')
|
os.system('sudo timedatectl set-ntp on')
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
|
Loading…
Reference in New Issue