Merge pull request #1888 from taosdata/feature/changshuaiqiang/testcase
add test case
This commit is contained in:
commit
2ef37deafd
|
@ -84,4 +84,7 @@ python3 ./test.py $1 -f import_merge/importTRestart.py
|
|||
|
||||
# user
|
||||
python3 ./test.py $1 -f user/user_create.py
|
||||
python3 ./test.py $1 -f user/pass_len.py
|
||||
python3 ./test.py $1 -f user/pass_len.py
|
||||
|
||||
# table
|
||||
#python3 ./test.py $1 -f table/del_stable.py
|
|
@ -0,0 +1,50 @@
|
|||
###################################################################
|
||||
# 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 sys
|
||||
import taos
|
||||
from util.log import tdLog
|
||||
from util.cases import tdCases
|
||||
from util.sql import tdSql
|
||||
|
||||
|
||||
class TDTestCase:
|
||||
def init(self, conn):
|
||||
tdLog.debug("start to execute %s" % __file__)
|
||||
tdSql.init(conn.cursor())
|
||||
|
||||
def run(self):
|
||||
tdSql.prepare()
|
||||
|
||||
tdSql.execute("drop database if exists db")
|
||||
print("==============step1")
|
||||
tdSql.execute("create database db")
|
||||
tdSql.execute("create table db.st (ts timestamp, i int) tags(j int)")
|
||||
tdSql.execute("create table db.tb using st tags(1)")
|
||||
tdSql.execute("insert into db.tb values(now, 1)")
|
||||
|
||||
print("==============step2")
|
||||
try:
|
||||
tdSql.execute("drop table db.st")
|
||||
except Exception as e:
|
||||
tdLog.exit(e)
|
||||
tdSql.execute("select * from db.st")
|
||||
tdSql.checkRows(1)
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
tdLog.success("%s successfully executed" % __file__)
|
||||
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -18,3 +18,5 @@ run general/table/vgroup.sim
|
|||
run general/user/basic1.sim
|
||||
run general/user/pass_alter.sim
|
||||
run general/vector/single.sim
|
||||
run general/connection/connection.sim
|
||||
run general/user/authority.sim
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/cfg.sh -n dnode1 -c wallevel -v 0
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sleep 3000
|
||||
sql connect
|
||||
|
||||
print ============= step1
|
||||
sql close
|
||||
print close1
|
||||
sql connect
|
||||
|
||||
print ============= step2
|
||||
sql close
|
||||
sql connect
|
||||
|
||||
print ============= step3
|
||||
sql close
|
||||
sql connect write
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -30,6 +30,7 @@ sleep 2000
|
|||
system sh/exec.sh -n dnode1 -s start
|
||||
sleep 3000
|
||||
sql connect
|
||||
sql reset query cache
|
||||
|
||||
print ======== step1
|
||||
sql create database d1 replica 1
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
sleep 3000
|
||||
|
||||
print ============= step1
|
||||
sql create user read pass 'taosdata'
|
||||
sql create user write pass 'taosdata'
|
||||
sql show users
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============= step2
|
||||
sql close
|
||||
sql connect read
|
||||
sleep 2000
|
||||
|
||||
sql create database dread
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============= step3
|
||||
sql close
|
||||
sql connect write
|
||||
sleep 2000
|
||||
|
||||
sql create database dwrite
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============ step4
|
||||
sql close
|
||||
sql connect
|
||||
sleep 2000
|
||||
|
||||
sql show databases
|
||||
if $row != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============ step5
|
||||
sql close
|
||||
sql connect read
|
||||
sleep 2000
|
||||
|
||||
sql drop database dread
|
||||
sql drop database dwrite -x step51
|
||||
|
||||
step51:
|
||||
|
||||
sql close
|
||||
sql connect
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql close
|
||||
sql connect
|
||||
sleep 2000
|
||||
sql drop database d1
|
||||
sql drop database d2
|
||||
sql drop database d3
|
||||
sql drop database d4
|
||||
|
||||
system sh/exec_up.sh -n dnode1 -s stop -x SIGINT
|
Loading…
Reference in New Issue