Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
81481d87
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
81481d87
编写于
6月 24, 2022
作者:
H
Hui Li
提交者:
GitHub
6月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14178 from taosdata/test/chr/TD-14699
test: modify testcase of muti-mnodes
上级
35e234f1
d9b88d6c
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
37 addition
and
253 deletion
+37
-253
tests/pytest/util/cluster.py
tests/pytest/util/cluster.py
+26
-236
tests/system-test/6-cluster/5dnode3mnodeStop.py
tests/system-test/6-cluster/5dnode3mnodeStop.py
+0
-10
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+1
-1
tests/system-test/test.py
tests/system-test/test.py
+10
-6
未找到文件。
tests/pytest/util/cluster.py
浏览文件 @
81481d87
...
@@ -21,44 +21,38 @@ class ClusterDnodes(TDDnodes):
...
@@ -21,44 +21,38 @@ class ClusterDnodes(TDDnodes):
self
.
testCluster
=
False
self
.
testCluster
=
False
self
.
valgrind
=
0
self
.
valgrind
=
0
self
.
killValgrind
=
1
self
.
killValgrind
=
1
self
.
independent
=
True
self
.
dnodeNums
=
5
# def getTDDnodes(dnodeNums):
# return
class
ConfigureyCluster
:
class
ConfigureyCluster
:
"""configure dnodes and return TDDnodes list, it can """
"""This will create defined number of dnodes and create a cluset.
at the same time, it will return TDDnodes list: dnodes, """
hostname
=
socket
.
gethostname
()
def
__init__
(
self
):
def
__init__
(
self
):
self
.
dnodes
=
None
self
.
dnodes
=
[]
self
.
dnode
s_n
ums
=
5
self
.
dnode
N
ums
=
5
self
.
independent
=
True
self
.
independent
=
True
self
.
start
_p
ort
=
6030
self
.
start
P
ort
=
6030
self
.
portStep
=
100
self
.
portStep
=
100
hostname1
=
socket
.
gethostname
()
self
.
mnodeNums
=
0
def
configure_cluster
(
self
,
dnode
s_nums
=
5
,
independent
=
True
,
start_port
=
6030
,
portStep
=
100
,
hostname
=
"%s"
%
hostname1
):
def
configure_cluster
(
self
,
dnode
Nums
=
5
,
mnodeNums
=
0
,
startPort
=
6030
,
portStep
=
100
,
hostname
=
"%s"
%
hostname
):
self
.
start
_port
=
int
(
start_p
ort
)
self
.
start
Port
=
int
(
startP
ort
)
self
.
portStep
=
int
(
portStep
)
self
.
portStep
=
int
(
portStep
)
self
.
hostname
=
hostname
self
.
hostname
=
hostname
self
.
dnode
s_nums
=
int
(
dnodes_n
ums
)
self
.
dnode
Nums
=
int
(
dnodeN
ums
)
self
.
independent
=
independent
self
.
mnodeNums
=
int
(
mnodeNums
)
self
.
dnodes
=
[]
self
.
dnodes
=
[]
start
_port_sec
=
6130
start
Port_sec
=
int
(
startPort
+
portStep
)
for
num
in
range
(
1
,
(
self
.
dnode
s_n
ums
+
1
)):
for
num
in
range
(
1
,
(
self
.
dnode
N
ums
+
1
)):
dnode
=
TDDnode
(
num
)
dnode
=
TDDnode
(
num
)
dnode
.
addExtraCfg
(
"firstEp"
,
f
"
{
hostname
}
:
{
self
.
start
_p
ort
}
"
)
dnode
.
addExtraCfg
(
"firstEp"
,
f
"
{
hostname
}
:
{
self
.
start
P
ort
}
"
)
dnode
.
addExtraCfg
(
"fqdn"
,
f
"
{
hostname
}
"
)
dnode
.
addExtraCfg
(
"fqdn"
,
f
"
{
hostname
}
"
)
dnode
.
addExtraCfg
(
"serverPort"
,
f
"
{
self
.
start_port
+
(
num
-
1
)
*
self
.
portStep
}
"
)
dnode
.
addExtraCfg
(
"serverPort"
,
f
"
{
self
.
startPort
+
(
num
-
1
)
*
self
.
portStep
}
"
)
# dnode.addExtraCfg("monitorFqdn", hostname)
dnode
.
addExtraCfg
(
"secondEp"
,
f
"
{
hostname
}
:
{
startPort_sec
}
"
)
# dnode.addExtraCfg("monitorPort", 7043)
dnode
.
addExtraCfg
(
"secondEp"
,
f
"
{
hostname
}
:
{
start_port_sec
}
"
)
# configure dnoe of independent mnodes
# configure three dnoe don't support vnodes
if
num
<=
self
.
mnodeNums
and
self
.
mnodeNums
!=
0
:
if
self
.
dnodes_nums
>
4
:
if
self
.
independent
and
(
num
<
4
):
dnode
.
addExtraCfg
(
"supportVnodes"
,
0
)
dnode
.
addExtraCfg
(
"supportVnodes"
,
0
)
# print(dnode)
# print(dnode)
self
.
dnodes
.
append
(
dnode
)
self
.
dnodes
.
append
(
dnode
)
...
@@ -69,24 +63,7 @@ class ConfigureyCluster:
...
@@ -69,24 +63,7 @@ class ConfigureyCluster:
for
dnode
in
self
.
dnodes
[
1
:]:
for
dnode
in
self
.
dnodes
[
1
:]:
# print(dnode.cfgDict)
# print(dnode.cfgDict)
dnode_id
=
dnode
.
cfgDict
[
"fqdn"
]
+
":"
+
dnode
.
cfgDict
[
"serverPort"
]
dnode_id
=
dnode
.
cfgDict
[
"fqdn"
]
+
":"
+
dnode
.
cfgDict
[
"serverPort"
]
print
(
dnode_id
)
tdSql
.
execute
(
" create dnode '%s';"
%
dnode_id
)
tdSql
.
execute
(
" create dnode '%s';"
%
dnode_id
)
# count=0
# while count < 10:
# time.sleep(1)
# tdSql.query("show dnodes;")
# if tdSql.checkRows(self.dnodes_nums) :
# print("mnode is three nodes")
# if tdSql.queryResult[0][4]=='leader' :
# if tdSql.queryResult[2][4]=='offline':
# if tdSql.queryResult[1][2]=='follower':
# print("stop mnodes on dnode 3 successfully in 10s")
# break
# count+=1
# else:
# print("stop mnodes on dnode 3 failed in 10s")
# return -1
checkstatus
=
False
...
@@ -97,206 +74,19 @@ class ConfigureyCluster:
...
@@ -97,206 +74,19 @@ class ConfigureyCluster:
tdSql
.
query
(
"show dnodes"
)
tdSql
.
query
(
"show dnodes"
)
# tdLog.debug(tdSql.queryResult)
# tdLog.debug(tdSql.queryResult)
status
=
0
status
=
0
for
i
in
range
(
self
.
dnode
s_n
ums
):
for
i
in
range
(
self
.
dnode
N
ums
):
if
tdSql
.
queryResult
[
i
][
4
]
==
"ready"
:
if
tdSql
.
queryResult
[
i
][
4
]
==
"ready"
:
status
+=
1
status
+=
1
tdLog
.
debug
(
status
)
#
tdLog.debug(status)
if
status
==
self
.
dnode
s_n
ums
:
if
status
==
self
.
dnode
N
ums
:
tdLog
.
debug
(
" create cluster with %d dnode and check cluster dnode all ready within 5s! "
%
self
.
dnode
s_n
ums
)
tdLog
.
debug
(
" create cluster with %d dnode and check cluster dnode all ready within 5s! "
%
self
.
dnode
N
ums
)
break
break
count
+=
1
count
+=
1
time
.
sleep
(
1
)
time
.
sleep
(
1
)
else
:
else
:
tdLog
.
debug
(
"create cluster with %d dnode but check dnode not ready within 5s ! "
%
self
.
dnode
s_n
ums
)
tdLog
.
debug
(
"create cluster with %d dnode but check dnode not ready within 5s ! "
%
self
.
dnode
N
ums
)
return
-
1
return
-
1
cluster
=
ConfigureyCluster
()
cluster
=
ConfigureyCluster
()
\ No newline at end of file
# def start(self ,dnodes_nums):
# self.TDDnodes = ClusterDnodes(dnodes)
# self.TDDnodes.init("")
# self.TDDnodes.setTestCluster(testCluster)
# self.TDDnodes.setValgrind(valgrind)
# self.TDDnodes.stopAll()
# for dnode in self.TDDnodes.dnodes:
# self.TDDnodes.deploy(dnode.index,{})
# for dnode in self.TDDnodes.dnodes:
# self.TDDnodes.starttaosd(dnode.index)
# # create cluster
# for dnode in self.TDDnodes.dnodes[1:]:
# # print(dnode.cfgDict)
# dnode_id = dnode.cfgDict["fqdn"] + ":" +dnode.cfgDict["serverPort"]
# dnode_first_host = dnode.cfgDict["firstEp"].split(":")[0]
# dnode_first_port = dnode.cfgDict["firstEp"].split(":")[-1]
# cmd = f" taos -h {dnode_first_host} -P {dnode_first_port} -s ' create dnode \"{dnode_id} \" ' ;"
# print(cmd)
# os.system(cmd)
# time.sleep(2)
# tdLog.info(" create cluster with %d dnode done! " %dnodes_nums)
# def buildcluster(self,dnodenumber):
# self.depoly_cluster(dnodenumber)
# self.master_dnode = self.TDDnodes.dnodes[0]
# self.host=self.master_dnode.cfgDict["fqdn"]
# conn1 = taos.connect(self.master_dnode.cfgDict["fqdn"] , config=self.master_dnode.cfgDir)
# tdSql.init(conn1.cursor())
# def checkdnodes(self,dnodenumber):
# count=0
# while count < 10:
# time.sleep(1)
# statusReadyBumber=0
# tdSql.query("show dnodes;")
# if tdSql.checkRows(dnodenumber) :
# print("dnode is %d nodes"%dnodenumber)
# for i in range(dnodenumber):
# if tdSql.queryResult[i][4] !='ready' :
# status=tdSql.queryResult[i][4]
# print("dnode:%d status is %s "%(i,status))
# break
# else:
# statusReadyBumber+=1
# print(statusReadyBumber)
# if statusReadyBumber == dnodenumber :
# print("all of %d mnodes is ready in 10s "%dnodenumber)
# return True
# break
# count+=1
# else:
# print("%d mnodes is not ready in 10s "%dnodenumber)
# return False
# def check3mnode(self):
# count=0
# while count < 10:
# time.sleep(1)
# tdSql.query("show mnodes;")
# if tdSql.checkRows(3) :
# print("mnode is three nodes")
# if tdSql.queryResult[0][2]=='leader' :
# if tdSql.queryResult[1][2]=='follower':
# if tdSql.queryResult[2][2]=='follower':
# print("three mnodes is ready in 10s")
# break
# elif tdSql.queryResult[0][2]=='follower' :
# if tdSql.queryResult[1][2]=='leader':
# if tdSql.queryResult[2][2]=='follower':
# print("three mnodes is ready in 10s")
# break
# elif tdSql.queryResult[0][2]=='follower' :
# if tdSql.queryResult[1][2]=='follower':
# if tdSql.queryResult[2][2]=='leader':
# print("three mnodes is ready in 10s")
# break
# count+=1
# else:
# print("three mnodes is not ready in 10s ")
# return -1
# tdSql.query("show mnodes;")
# tdSql.checkRows(3)
# tdSql.checkData(0,1,'%s:6030'%self.host)
# tdSql.checkData(0,3,'ready')
# tdSql.checkData(1,1,'%s:6130'%self.host)
# tdSql.checkData(1,3,'ready')
# tdSql.checkData(2,1,'%s:6230'%self.host)
# tdSql.checkData(2,3,'ready')
# def check3mnode1off(self):
# count=0
# while count < 10:
# time.sleep(1)
# tdSql.query("show mnodes;")
# if tdSql.checkRows(3) :
# print("mnode is three nodes")
# if tdSql.queryResult[0][2]=='offline' :
# if tdSql.queryResult[1][2]=='leader':
# if tdSql.queryResult[2][2]=='follower':
# print("stop mnodes on dnode 2 successfully in 10s")
# break
# elif tdSql.queryResult[1][2]=='follower':
# if tdSql.queryResult[2][2]=='leader':
# print("stop mnodes on dnode 2 successfully in 10s")
# break
# count+=1
# else:
# print("stop mnodes on dnode 2 failed in 10s ")
# return -1
# tdSql.error("drop mnode on dnode 1;")
# tdSql.query("show mnodes;")
# tdSql.checkRows(3)
# tdSql.checkData(0,1,'%s:6030'%self.host)
# tdSql.checkData(0,2,'offline')
# tdSql.checkData(0,3,'ready')
# tdSql.checkData(1,1,'%s:6130'%self.host)
# tdSql.checkData(1,3,'ready')
# tdSql.checkData(2,1,'%s:6230'%self.host)
# tdSql.checkData(2,3,'ready')
# def check3mnode2off(self):
# count=0
# while count < 40:
# time.sleep(1)
# tdSql.query("show mnodes;")
# if tdSql.checkRows(3) :
# print("mnode is three nodes")
# if tdSql.queryResult[0][2]=='leader' :
# if tdSql.queryResult[1][2]=='offline':
# if tdSql.queryResult[2][2]=='follower':
# print("stop mnodes on dnode 2 successfully in 10s")
# break
# count+=1
# else:
# print("stop mnodes on dnode 2 failed in 10s ")
# return -1
# tdSql.error("drop mnode on dnode 2;")
# tdSql.query("show mnodes;")
# tdSql.checkRows(3)
# tdSql.checkData(0,1,'%s:6030'%self.host)
# tdSql.checkData(0,2,'leader')
# tdSql.checkData(0,3,'ready')
# tdSql.checkData(1,1,'%s:6130'%self.host)
# tdSql.checkData(1,2,'offline')
# tdSql.checkData(1,3,'ready')
# tdSql.checkData(2,1,'%s:6230'%self.host)
# tdSql.checkData(2,2,'follower')
# tdSql.checkData(2,3,'ready')
# def check3mnode3off(self):
# count=0
# while count < 10:
# time.sleep(1)
# tdSql.query("show mnodes;")
# if tdSql.checkRows(3) :
# print("mnode is three nodes")
# if tdSql.queryResult[0][2]=='leader' :
# if tdSql.queryResult[2][2]=='offline':
# if tdSql.queryResult[1][2]=='follower':
# print("stop mnodes on dnode 3 successfully in 10s")
# break
# count+=1
# else:
# print("stop mnodes on dnode 3 failed in 10s")
# return -1
# tdSql.error("drop mnode on dnode 3;")
# tdSql.query("show mnodes;")
# tdSql.checkRows(3)
# tdSql.checkData(0,1,'%s:6030'%self.host)
# tdSql.checkData(0,2,'leader')
# tdSql.checkData(0,3,'ready')
# tdSql.checkData(1,1,'%s:6130'%self.host)
# tdSql.checkData(1,2,'follower')
# tdSql.checkData(1,3,'ready')
# tdSql.checkData(2,1,'%s:6230'%self.host)
# tdSql.checkData(2,2,'offline')
# tdSql.checkData(2,3,'ready')
tests/system-test/6-cluster/5dnode3mnodeStop.py
浏览文件 @
81481d87
...
@@ -159,13 +159,10 @@ class TDTestCase:
...
@@ -159,13 +159,10 @@ class TDTestCase:
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
1
,
1
,
'%s:6130'
%
self
.
host
)
tdSql
.
checkData
(
1
,
1
,
'%s:6130'
%
self
.
host
)
tdSql
.
checkData
(
1
,
2
,
'offline'
)
tdSql
.
checkData
(
1
,
3
,
'ready'
)
tdSql
.
checkData
(
1
,
3
,
'ready'
)
tdSql
.
checkData
(
2
,
1
,
'%s:6230'
%
self
.
host
)
tdSql
.
checkData
(
2
,
1
,
'%s:6230'
%
self
.
host
)
tdSql
.
checkData
(
2
,
2
,
'follower'
)
tdSql
.
checkData
(
2
,
3
,
'ready'
)
tdSql
.
checkData
(
2
,
3
,
'ready'
)
def
check3mnode3off
(
self
):
def
check3mnode3off
(
self
):
...
@@ -265,13 +262,6 @@ class TDTestCase:
...
@@ -265,13 +262,6 @@ class TDTestCase:
while
stopcount
<=
2
:
while
stopcount
<=
2
:
for
i
in
range
(
dnodenumber
):
for
i
in
range
(
dnodenumber
):
tdDnodes
[
i
].
stoptaosd
()
tdDnodes
[
i
].
stoptaosd
()
# if i == 1 :
# self.check3mnode2off()
# elif i == 2 :
# self.check3mnode3off()
# elif i == 0:
# self.check3mnode1off()
tdDnodes
[
i
].
starttaosd
()
tdDnodes
[
i
].
starttaosd
()
# self.check3mnode()
# self.check3mnode()
stopcount
+=
1
stopcount
+=
1
...
...
tests/system-test/fulltest.sh
浏览文件 @
81481d87
...
@@ -112,7 +112,7 @@ python3 ./test.py -f 2-query/twa.py
...
@@ -112,7 +112,7 @@ python3 ./test.py -f 2-query/twa.py
python3 ./test.py
-f
6-cluster/5dnode1mnode.py
python3 ./test.py
-f
6-cluster/5dnode1mnode.py
python3 ./test.py
-f
6-cluster/5dnode2mnode.py
python3 ./test.py
-f
6-cluster/5dnode2mnode.py
python3 ./test.py
-f
6-cluster/5dnode3mnodeStop.py
-N
5
python3 ./test.py
-f
6-cluster/5dnode3mnodeStop.py
-N
5
-M
3
# python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5
# python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5
# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py
# BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py
...
...
tests/system-test/test.py
浏览文件 @
81481d87
...
@@ -60,10 +60,11 @@ if __name__ == "__main__":
...
@@ -60,10 +60,11 @@ if __name__ == "__main__":
stop
=
0
stop
=
0
restart
=
False
restart
=
False
dnodeNums
=
1
dnodeNums
=
1
mnodeNums
=
0
updateCfgDict
=
{}
updateCfgDict
=
{}
execCmd
=
""
execCmd
=
""
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:l:scghrd:k:e:N:'
,
[
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:l:scghrd:k:e:N:
M:
'
,
[
'file='
,
'path='
,
'master'
,
'logSql'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
,
'restart'
,
'updateCfgDict'
,
'killv'
,
'execCmd'
,
'dnodeNums'
])
'file='
,
'path='
,
'master'
,
'logSql'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
,
'restart'
,
'updateCfgDict'
,
'killv'
,
'execCmd'
,
'dnodeNums'
,
'mnodeNums'
])
for
key
,
value
in
opts
:
for
key
,
value
in
opts
:
if
key
in
[
'-h'
,
'--help'
]:
if
key
in
[
'-h'
,
'--help'
]:
tdLog
.
printNoPrefix
(
tdLog
.
printNoPrefix
(
...
@@ -79,7 +80,8 @@ if __name__ == "__main__":
...
@@ -79,7 +80,8 @@ if __name__ == "__main__":
tdLog
.
printNoPrefix
(
'-d update cfg dict, base64 json str'
)
tdLog
.
printNoPrefix
(
'-d update cfg dict, base64 json str'
)
tdLog
.
printNoPrefix
(
'-k not kill valgrind processer'
)
tdLog
.
printNoPrefix
(
'-k not kill valgrind processer'
)
tdLog
.
printNoPrefix
(
'-e eval str to run'
)
tdLog
.
printNoPrefix
(
'-e eval str to run'
)
tdLog
.
printNoPrefix
(
'-N create dnodes numbers clusters'
)
tdLog
.
printNoPrefix
(
'-N create dnodes numbers in clusters'
)
tdLog
.
printNoPrefix
(
'-M create mnode numbers in clusters'
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
@@ -133,6 +135,9 @@ if __name__ == "__main__":
...
@@ -133,6 +135,9 @@ if __name__ == "__main__":
if
key
in
[
'-N'
,
'--dnodeNums'
]:
if
key
in
[
'-N'
,
'--dnodeNums'
]:
dnodeNums
=
value
dnodeNums
=
value
if
key
in
[
'-M'
,
'--mnodeNums'
]:
mnodeNums
=
value
if
not
execCmd
==
""
:
if
not
execCmd
==
""
:
tdDnodes
.
init
(
deployPath
)
tdDnodes
.
init
(
deployPath
)
print
(
execCmd
)
print
(
execCmd
)
...
@@ -244,9 +249,8 @@ if __name__ == "__main__":
...
@@ -244,9 +249,8 @@ if __name__ == "__main__":
tdDnodes
.
start
(
1
)
tdDnodes
.
start
(
1
)
tdCases
.
logSql
(
logSql
)
tdCases
.
logSql
(
logSql
)
else
:
else
:
print
(
"start cluster and dnodes number"
)
tdLog
.
debug
(
"create an cluster with %s nodes and make %s dnode as independent mnode"
%
(
dnodeNums
,
mnodeNums
))
dnodeslist
=
cluster
.
configure_cluster
(
dnodeNums
=
dnodeNums
,
mnodeNums
=
mnodeNums
)
dnodeslist
=
cluster
.
configure_cluster
(
dnodes_nums
=
dnodeNums
,
independent
=
True
)
tdDnodes
=
ClusterDnodes
(
dnodeslist
)
tdDnodes
=
ClusterDnodes
(
dnodeslist
)
tdDnodes
.
init
(
deployPath
,
masterIp
)
tdDnodes
.
init
(
deployPath
,
masterIp
)
tdDnodes
.
setTestCluster
(
testCluster
)
tdDnodes
.
setTestCluster
(
testCluster
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录