Merge pull request #26457 from taosdata/test/3.0/TS-5130
test: adding test case for TS-5130
This commit is contained in:
commit
cfb24bc379
|
@ -301,6 +301,7 @@
|
|||
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TS-3581.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TS-3311.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TS-3821.py
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TS-5130.py
|
||||
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/balance_vgroups_r1.py -N 6
|
||||
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/taosShell.py
|
||||
|
|
|
@ -538,21 +538,21 @@ class TDCom:
|
|||
tdLog.info("cfgPath: %s" % cfgPath)
|
||||
return cfgPath
|
||||
|
||||
def newcon(self,host='localhost',port=6030,user='root',password='taosdata'):
|
||||
con=taos.connect(host=host, user=user, password=password, port=port)
|
||||
def newcon(self,host='localhost',port=6030,user='root',password='taosdata', database=None):
|
||||
con=taos.connect(host=host, user=user, password=password, port=port, database=database)
|
||||
# print(con)
|
||||
return con
|
||||
|
||||
def newcur(self,host='localhost',port=6030,user='root',password='taosdata'):
|
||||
def newcur(self,host='localhost',port=6030,user='root',password='taosdata',database=None):
|
||||
cfgPath = self.getClientCfgPath()
|
||||
con=taos.connect(host=host, user=user, password=password, config=cfgPath, port=port)
|
||||
con=taos.connect(host=host, user=user, password=password, config=cfgPath, port=port,database=database)
|
||||
cur=con.cursor()
|
||||
# print(cur)
|
||||
return cur
|
||||
|
||||
def newTdSql(self, host='localhost',port=6030,user='root',password='taosdata'):
|
||||
def newTdSql(self, host='localhost',port=6030,user='root',password='taosdata', database = None):
|
||||
newTdSql = TDSql()
|
||||
cur = self.newcur(host=host,port=port,user=user,password=password)
|
||||
cur = self.newcur(host=host,port=port,user=user,password=password, database=database)
|
||||
newTdSql.init(cur, False)
|
||||
return newTdSql
|
||||
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
from util.log import *
|
||||
from util.cases import *
|
||||
from util.sql import *
|
||||
from util.common import *
|
||||
import taos
|
||||
|
||||
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn, logSQl, replicaVal=1):
|
||||
self.replicaVar = int(replicaVal)
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
self.conn = conn
|
||||
tdSql.init(conn.cursor(), False)
|
||||
self.passwd = {'root':'taosdata',
|
||||
'test':'test'}
|
||||
def prepare_user(self):
|
||||
tdSql.execute(f"create user test pass 'test' sysinfo 1")
|
||||
|
||||
def test_connect_user(self, uname):
|
||||
try:
|
||||
for db in ['information_schema', 'performance_schema']:
|
||||
new_tdsql = tdCom.newTdSql(user=uname, password=self.passwd[uname], database=db)
|
||||
new_tdsql.query('show databases')
|
||||
new_tdsql.checkData(0, 0, 'information_schema')
|
||||
new_tdsql.checkData(1, 0, 'performance_schema')
|
||||
tdLog.success(f"Test User {uname} for {db} .......[OK]")
|
||||
except:
|
||||
tdLog.exit(f'{__file__} failed')
|
||||
|
||||
def run(self):
|
||||
self.prepare_user()
|
||||
self.test_connect_user('root')
|
||||
self.test_connect_user('test')
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success(f"{__file__} successfully executed")
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue