Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bd5381f8
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
bd5381f8
编写于
7月 30, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix test cases
上级
352a62c2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
150 addition
and
150 deletion
+150
-150
tests/system-test/6-cluster/5dnode1mnode.py
tests/system-test/6-cluster/5dnode1mnode.py
+14
-14
tests/system-test/6-cluster/5dnode3mnodeDrop.py
tests/system-test/6-cluster/5dnode3mnodeDrop.py
+28
-28
tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py
...-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py
+14
-14
tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py
...t/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py
+15
-15
tests/system-test/6-cluster/5dnode3mnodeSeperate1VnodeStopInsert.py
...em-test/6-cluster/5dnode3mnodeSeperate1VnodeStopInsert.py
+29
-29
tests/system-test/6-cluster/5dnode3mnodeStopInsert.py
tests/system-test/6-cluster/5dnode3mnodeStopInsert.py
+33
-33
tests/system-test/6-cluster/clusterCommonCreate.py
tests/system-test/6-cluster/clusterCommonCreate.py
+17
-17
未找到文件。
tests/system-test/6-cluster/5dnode1mnode.py
浏览文件 @
bd5381f8
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
import
taos
import
taos
import
sys
import
sys
import
time
import
time
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
...
@@ -18,7 +18,7 @@ class MyDnodes(TDDnodes):
...
@@ -18,7 +18,7 @@ class MyDnodes(TDDnodes):
super
(
MyDnodes
,
self
).
__init__
()
super
(
MyDnodes
,
self
).
__init__
()
self
.
dnodes
=
dnodes_lists
# dnode must be TDDnode instance
self
.
dnodes
=
dnodes_lists
# dnode must be TDDnode instance
self
.
simDeployed
=
False
self
.
simDeployed
=
False
class
TDTestCase
:
class
TDTestCase
:
noConn
=
True
noConn
=
True
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
...
@@ -29,7 +29,7 @@ class TDTestCase:
...
@@ -29,7 +29,7 @@ class TDTestCase:
self
.
host
=
self
.
master_dnode
.
cfgDict
[
"fqdn"
]
self
.
host
=
self
.
master_dnode
.
cfgDict
[
"fqdn"
]
conn1
=
taos
.
connect
(
self
.
master_dnode
.
cfgDict
[
"fqdn"
]
,
config
=
self
.
master_dnode
.
cfgDir
)
conn1
=
taos
.
connect
(
self
.
master_dnode
.
cfgDict
[
"fqdn"
]
,
config
=
self
.
master_dnode
.
cfgDir
)
tdSql
.
init
(
conn1
.
cursor
())
tdSql
.
init
(
conn1
.
cursor
())
def
getBuildPath
(
self
):
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
@@ -46,12 +46,12 @@ class TDTestCase:
...
@@ -46,12 +46,12 @@ class TDTestCase:
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
break
return
buildPath
return
buildPath
def
depoly_cluster
(
self
,
dnodes_nums
):
def
depoly_cluster
(
self
,
dnodes_nums
):
testCluster
=
False
testCluster
=
False
valgrind
=
0
valgrind
=
0
hostname
=
socket
.
gethostname
()
hostname
=
socket
.
gethostname
()
dnodes
=
[]
dnodes
=
[]
start_port
=
6030
start_port
=
6030
...
@@ -63,7 +63,7 @@ class TDTestCase:
...
@@ -63,7 +63,7 @@ class TDTestCase:
dnode
.
addExtraCfg
(
"monitorFqdn"
,
hostname
)
dnode
.
addExtraCfg
(
"monitorFqdn"
,
hostname
)
dnode
.
addExtraCfg
(
"monitorPort"
,
7043
)
dnode
.
addExtraCfg
(
"monitorPort"
,
7043
)
dnodes
.
append
(
dnode
)
dnodes
.
append
(
dnode
)
self
.
TDDnodes
=
MyDnodes
(
dnodes
)
self
.
TDDnodes
=
MyDnodes
(
dnodes
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
...
@@ -71,11 +71,11 @@ class TDTestCase:
...
@@ -71,11 +71,11 @@ class TDTestCase:
self
.
TDDnodes
.
stopAll
()
self
.
TDDnodes
.
stopAll
()
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
starttaosd
(
dnode
.
index
)
self
.
TDDnodes
.
starttaosd
(
dnode
.
index
)
# create cluster
# create cluster
for
dnode
in
self
.
TDDnodes
.
dnodes
[
1
:]:
for
dnode
in
self
.
TDDnodes
.
dnodes
[
1
:]:
# print(dnode.cfgDict)
# print(dnode.cfgDict)
dnode_id
=
dnode
.
cfgDict
[
"fqdn"
]
+
":"
+
dnode
.
cfgDict
[
"serverPort"
]
dnode_id
=
dnode
.
cfgDict
[
"fqdn"
]
+
":"
+
dnode
.
cfgDict
[
"serverPort"
]
...
@@ -84,7 +84,7 @@ class TDTestCase:
...
@@ -84,7 +84,7 @@ class TDTestCase:
cmd
=
f
"
{
self
.
getBuildPath
()
}
/build/bin/taos -h
{
dnode_first_host
}
-P
{
dnode_first_port
}
-s
\"
create dnode
\\\"
{
dnode_id
}
\\\"\"
"
cmd
=
f
"
{
self
.
getBuildPath
()
}
/build/bin/taos -h
{
dnode_first_host
}
-P
{
dnode_first_port
}
-s
\"
create dnode
\\\"
{
dnode_id
}
\\\"\"
"
print
(
cmd
)
print
(
cmd
)
os
.
system
(
cmd
)
os
.
system
(
cmd
)
time
.
sleep
(
2
)
time
.
sleep
(
2
)
tdLog
.
info
(
" create cluster done! "
)
tdLog
.
info
(
" create cluster done! "
)
...
@@ -94,7 +94,7 @@ class TDTestCase:
...
@@ -94,7 +94,7 @@ class TDTestCase:
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -120,7 +120,7 @@ class TDTestCase:
...
@@ -120,7 +120,7 @@ class TDTestCase:
)
)
for
i
in
range
(
4
):
for
i
in
range
(
4
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags (
{
i
+
1
}
)'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags (
{
i
+
1
}
)'
)
tdSql
.
query
(
'show databases;'
)
tdSql
.
query
(
'show databases;'
)
tdSql
.
checkData
(
2
,
5
,
'off'
)
tdSql
.
checkData
(
2
,
5
,
'off'
)
tdSql
.
error
(
"alter database db strict 'off'"
)
tdSql
.
error
(
"alter database db strict 'off'"
)
...
@@ -135,7 +135,7 @@ class TDTestCase:
...
@@ -135,7 +135,7 @@ class TDTestCase:
return
taos
.
connect
(
host
=
host
,
port
=
int
(
port
),
config
=
config_dir
)
return
taos
.
connect
(
host
=
host
,
port
=
int
(
port
),
config
=
config_dir
)
def
run
(
self
):
def
run
(
self
):
# print(self.master_dnode.cfgDict)
# print(self.master_dnode.cfgDict)
self
.
five_dnode_one_mnode
()
self
.
five_dnode_one_mnode
()
...
@@ -145,4 +145,4 @@ class TDTestCase:
...
@@ -145,4 +145,4 @@ class TDTestCase:
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/system-test/6-cluster/5dnode3mnodeDrop.py
浏览文件 @
bd5381f8
...
@@ -3,7 +3,7 @@ from paramiko import HostKeys
...
@@ -3,7 +3,7 @@ from paramiko import HostKeys
import
taos
import
taos
import
sys
import
sys
import
time
import
time
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
...
@@ -19,7 +19,7 @@ class MyDnodes(TDDnodes):
...
@@ -19,7 +19,7 @@ class MyDnodes(TDDnodes):
super
(
MyDnodes
,
self
).
__init__
()
super
(
MyDnodes
,
self
).
__init__
()
self
.
dnodes
=
dnodes_lists
# dnode must be TDDnode instance
self
.
dnodes
=
dnodes_lists
# dnode must be TDDnode instance
self
.
simDeployed
=
False
self
.
simDeployed
=
False
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
...
@@ -48,7 +48,7 @@ class TDTestCase:
...
@@ -48,7 +48,7 @@ class TDTestCase:
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
break
return
buildPath
return
buildPath
def
insert_data
(
self
,
count
):
def
insert_data
(
self
,
count
):
# fisrt add data : db\stable\childtable\general table
# fisrt add data : db\stable\childtable\general table
for
couti
in
count
:
for
couti
in
count
:
...
@@ -70,10 +70,10 @@ class TDTestCase:
...
@@ -70,10 +70,10 @@ class TDTestCase:
for
i
in
range
(
4
):
for
i
in
range
(
4
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags (
{
i
+
1
}
)'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags (
{
i
+
1
}
)'
)
def
depoly_cluster
(
self
,
dnodes_nums
):
def
depoly_cluster
(
self
,
dnodes_nums
):
testCluster
=
False
testCluster
=
False
valgrind
=
0
valgrind
=
0
hostname
=
socket
.
gethostname
()
hostname
=
socket
.
gethostname
()
tdLog
.
debug
(
hostname
)
tdLog
.
debug
(
hostname
)
dnodes
=
[]
dnodes
=
[]
...
@@ -88,7 +88,7 @@ class TDTestCase:
...
@@ -88,7 +88,7 @@ class TDTestCase:
dnode
.
addExtraCfg
(
"monitorPort"
,
7043
)
dnode
.
addExtraCfg
(
"monitorPort"
,
7043
)
dnode
.
addExtraCfg
(
"secondEp"
,
f
"
{
hostname
}
:
{
start_port_sec
}
"
)
dnode
.
addExtraCfg
(
"secondEp"
,
f
"
{
hostname
}
:
{
start_port_sec
}
"
)
dnodes
.
append
(
dnode
)
dnodes
.
append
(
dnode
)
self
.
TDDnodes
=
MyDnodes
(
dnodes
)
self
.
TDDnodes
=
MyDnodes
(
dnodes
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
...
@@ -96,11 +96,11 @@ class TDTestCase:
...
@@ -96,11 +96,11 @@ class TDTestCase:
self
.
TDDnodes
.
stopAll
()
self
.
TDDnodes
.
stopAll
()
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
starttaosd
(
dnode
.
index
)
self
.
TDDnodes
.
starttaosd
(
dnode
.
index
)
# create cluster
# create cluster
for
dnode
in
self
.
TDDnodes
.
dnodes
[
1
:]:
for
dnode
in
self
.
TDDnodes
.
dnodes
[
1
:]:
# tdLog.debug(dnode.cfgDict)
# tdLog.debug(dnode.cfgDict)
dnode_id
=
dnode
.
cfgDict
[
"fqdn"
]
+
":"
+
dnode
.
cfgDict
[
"serverPort"
]
dnode_id
=
dnode
.
cfgDict
[
"fqdn"
]
+
":"
+
dnode
.
cfgDict
[
"serverPort"
]
...
@@ -109,7 +109,7 @@ class TDTestCase:
...
@@ -109,7 +109,7 @@ class TDTestCase:
cmd
=
f
" taos -h
{
dnode_first_host
}
-P
{
dnode_first_port
}
-s ' create dnode
\"
{
dnode_id
}
\"
' ;"
cmd
=
f
" taos -h
{
dnode_first_host
}
-P
{
dnode_first_port
}
-s ' create dnode
\"
{
dnode_id
}
\"
' ;"
tdLog
.
debug
(
cmd
)
tdLog
.
debug
(
cmd
)
os
.
system
(
cmd
)
os
.
system
(
cmd
)
time
.
sleep
(
2
)
time
.
sleep
(
2
)
tdLog
.
info
(
" create cluster with %d dnode done! "
%
dnodes_nums
)
tdLog
.
info
(
" create cluster with %d dnode done! "
%
dnodes_nums
)
...
@@ -118,8 +118,8 @@ class TDTestCase:
...
@@ -118,8 +118,8 @@ class TDTestCase:
while
count
<
10
:
while
count
<
10
:
time
.
sleep
(
1
)
time
.
sleep
(
1
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
query
(
"show mnodes;"
)
if
tdSql
.
checkRows
(
3
)
:
if
tdSql
.
checkRows
(
3
)
:
tdLog
.
debug
(
"mnode is three nodes"
)
tdLog
.
debug
(
"mnode is three nodes"
)
if
tdSql
.
queryResult
[
0
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
0
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
...
@@ -129,20 +129,20 @@ class TDTestCase:
...
@@ -129,20 +129,20 @@ class TDTestCase:
if
tdSql
.
queryResult
[
1
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
tdLog
.
debug
(
"three mnodes is ready in 10s"
)
tdLog
.
debug
(
"three mnodes is ready in 10s"
)
break
break
elif
tdSql
.
queryResult
[
0
][
2
]
==
'follower'
:
elif
tdSql
.
queryResult
[
0
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'leader'
:
tdLog
.
debug
(
"three mnodes is ready in 10s"
)
tdLog
.
debug
(
"three mnodes is ready in 10s"
)
break
break
count
+=
1
count
+=
1
else
:
else
:
tdLog
.
debug
(
tdSql
.
queryResult
)
tdLog
.
debug
(
tdSql
.
queryResult
)
tdLog
.
debug
(
"three mnodes is not ready in 10s "
)
tdLog
.
debug
(
"three mnodes is not ready in 10s "
)
return
-
1
return
-
1
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
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
1
,
1
,
'%s:6130'
%
self
.
host
)
tdSql
.
checkData
(
1
,
1
,
'%s:6130'
%
self
.
host
)
...
@@ -169,11 +169,11 @@ class TDTestCase:
...
@@ -169,11 +169,11 @@ class TDTestCase:
count
+=
1
count
+=
1
else
:
else
:
tdLog
.
debug
(
"stop mnodes on dnode 2 failed in 10s "
)
tdLog
.
debug
(
"stop mnodes on dnode 2 failed in 10s "
)
return
-
1
return
-
1
tdSql
.
error
(
"drop mnode on dnode 1;"
)
tdSql
.
error
(
"drop mnode on dnode 1;"
)
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
,
'offline'
)
tdSql
.
checkData
(
0
,
2
,
'offline'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -200,8 +200,8 @@ class TDTestCase:
...
@@ -200,8 +200,8 @@ class TDTestCase:
return
-
1
return
-
1
tdSql
.
error
(
"drop mnode on dnode 2;"
)
tdSql
.
error
(
"drop mnode on dnode 2;"
)
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
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -229,8 +229,8 @@ class TDTestCase:
...
@@ -229,8 +229,8 @@ class TDTestCase:
tdLog
.
debug
(
"stop mnodes on dnode 3 failed in 10s"
)
tdLog
.
debug
(
"stop mnodes on dnode 3 failed in 10s"
)
return
-
1
return
-
1
tdSql
.
error
(
"drop mnode on dnode 3;"
)
tdSql
.
error
(
"drop mnode on dnode 3;"
)
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
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -249,8 +249,8 @@ class TDTestCase:
...
@@ -249,8 +249,8 @@ class TDTestCase:
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -270,8 +270,8 @@ class TDTestCase:
...
@@ -270,8 +270,8 @@ class TDTestCase:
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
tdLog
.
debug
(
tdSql
.
queryResult
)
tdLog
.
debug
(
tdSql
.
queryResult
)
# drop follower of mnode
# drop follower of mnode
dropcount
=
0
dropcount
=
0
while
dropcount
<=
10
:
while
dropcount
<=
10
:
for
i
in
range
(
1
,
3
):
for
i
in
range
(
1
,
3
):
tdLog
.
debug
(
"drop mnode on dnode %d"
%
(
i
+
1
))
tdLog
.
debug
(
"drop mnode on dnode %d"
%
(
i
+
1
))
...
@@ -306,7 +306,7 @@ class TDTestCase:
...
@@ -306,7 +306,7 @@ class TDTestCase:
return
taos
.
connect
(
host
=
host
,
port
=
int
(
port
),
config
=
config_dir
)
return
taos
.
connect
(
host
=
host
,
port
=
int
(
port
),
config
=
config_dir
)
def
run
(
self
):
def
run
(
self
):
# tdLog.debug(self.master_dnode.cfgDict)
# tdLog.debug(self.master_dnode.cfgDict)
self
.
buildcluster
(
5
)
self
.
buildcluster
(
5
)
self
.
five_dnode_three_mnode
()
self
.
five_dnode_three_mnode
()
...
@@ -316,4 +316,4 @@ class TDTestCase:
...
@@ -316,4 +316,4 @@ class TDTestCase:
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py
浏览文件 @
bd5381f8
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
import
taos
import
taos
import
sys
import
sys
import
time
import
time
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
...
@@ -12,13 +12,13 @@ from util.dnodes import TDDnode
...
@@ -12,13 +12,13 @@ from util.dnodes import TDDnode
from
util.cluster
import
*
from
util.cluster
import
*
sys
.
path
.
append
(
"./6-cluster"
)
sys
.
path
.
append
(
"./6-cluster"
)
from
clusterCommonCreate
import
*
from
clusterCommonCreate
import
*
from
clusterCommonCheck
import
clusterComCheck
from
clusterCommonCheck
import
clusterComCheck
import
time
import
time
import
socket
import
socket
import
subprocess
import
subprocess
from
multiprocessing
import
Process
from
multiprocessing
import
Process
import
threading
import
threading
import
time
import
time
import
inspect
import
inspect
import
ctypes
import
ctypes
...
@@ -56,7 +56,7 @@ class TDTestCase:
...
@@ -56,7 +56,7 @@ class TDTestCase:
if
res
==
0
:
if
res
==
0
:
raise
ValueError
(
"invalid thread id"
)
raise
ValueError
(
"invalid thread id"
)
elif
res
!=
1
:
elif
res
!=
1
:
# """if it returns a number greater than one, you're in trouble,
# """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect"""
# and you should call it again with exc=NULL to revert the effect"""
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
None
)
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
None
)
raise
SystemError
(
"PyThreadState_SetAsyncExc failed"
)
raise
SystemError
(
"PyThreadState_SetAsyncExc failed"
)
...
@@ -67,7 +67,7 @@ class TDTestCase:
...
@@ -67,7 +67,7 @@ class TDTestCase:
def
insertData
(
self
,
countstart
,
countstop
):
def
insertData
(
self
,
countstart
,
countstop
):
# fisrt add data : db\stable\childtable\general table
# fisrt add data : db\stable\childtable\general table
for
couti
in
range
(
countstart
,
countstop
):
for
couti
in
range
(
countstart
,
countstop
):
tdLog
.
debug
(
"drop database if exists db%d"
%
couti
)
tdLog
.
debug
(
"drop database if exists db%d"
%
couti
)
tdSql
.
execute
(
"drop database if exists db%d"
%
couti
)
tdSql
.
execute
(
"drop database if exists db%d"
%
couti
)
...
@@ -107,13 +107,13 @@ class TDTestCase:
...
@@ -107,13 +107,13 @@ class TDTestCase:
'ctbPrefix'
:
'ctb'
,
'ctbPrefix'
:
'ctb'
,
'ctbNum'
:
1
,
'ctbNum'
:
1
,
}
}
dnodeNumbers
=
int
(
dnodeNumbers
)
dnodeNumbers
=
int
(
dnodeNumbers
)
mnodeNums
=
int
(
mnodeNums
)
mnodeNums
=
int
(
mnodeNums
)
vnodeNumbers
=
int
(
dnodeNumbers
-
mnodeNums
)
vnodeNumbers
=
int
(
dnodeNumbers
-
mnodeNums
)
allDbNumbers
=
(
paraDict
[
'dbNumbers'
]
*
restartNumbers
)
allDbNumbers
=
(
paraDict
[
'dbNumbers'
]
*
restartNumbers
)
allStbNumbers
=
(
paraDict
[
'stbNumbers'
]
*
restartNumbers
)
allStbNumbers
=
(
paraDict
[
'stbNumbers'
]
*
restartNumbers
)
tdLog
.
info
(
"first check dnode and mnode"
)
tdLog
.
info
(
"first check dnode and mnode"
)
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
...
@@ -128,7 +128,7 @@ class TDTestCase:
...
@@ -128,7 +128,7 @@ class TDTestCase:
tdSql
.
execute
(
"create mnode on dnode 3"
)
tdSql
.
execute
(
"create mnode on dnode 3"
)
clusterComCheck
.
checkMnodeStatus
(
3
)
clusterComCheck
.
checkMnodeStatus
(
3
)
# add some error operations and
# add some error operations and
tdLog
.
info
(
"Confirm the status of the dnode again"
)
tdLog
.
info
(
"Confirm the status of the dnode again"
)
tdSql
.
error
(
"create mnode on dnode 2"
)
tdSql
.
error
(
"create mnode on dnode 2"
)
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
...
@@ -149,7 +149,7 @@ class TDTestCase:
...
@@ -149,7 +149,7 @@ class TDTestCase:
for
tr
in
threads
:
for
tr
in
threads
:
tr
.
start
()
tr
.
start
()
tdLog
.
info
(
"Take turns stopping Mnodes "
)
tdLog
.
info
(
"Take turns stopping Mnodes "
)
while
stopcount
<
restartNumbers
:
while
stopcount
<
restartNumbers
:
tdLog
.
info
(
" restart loop: %d"
%
stopcount
)
tdLog
.
info
(
" restart loop: %d"
%
stopcount
)
if
stopRole
==
"mnode"
:
if
stopRole
==
"mnode"
:
...
@@ -157,7 +157,7 @@ class TDTestCase:
...
@@ -157,7 +157,7 @@ class TDTestCase:
tdDnodes
[
i
].
stoptaosd
()
tdDnodes
[
i
].
stoptaosd
()
# sleep(10)
# sleep(10)
tdDnodes
[
i
].
starttaosd
()
tdDnodes
[
i
].
starttaosd
()
# sleep(10)
# sleep(10)
elif
stopRole
==
"vnode"
:
elif
stopRole
==
"vnode"
:
for
i
in
range
(
vnodeNumbers
):
for
i
in
range
(
vnodeNumbers
):
tdDnodes
[
i
+
mnodeNums
].
stoptaosd
()
tdDnodes
[
i
+
mnodeNums
].
stoptaosd
()
...
@@ -169,7 +169,7 @@ class TDTestCase:
...
@@ -169,7 +169,7 @@ class TDTestCase:
tdDnodes
[
i
].
stoptaosd
()
tdDnodes
[
i
].
stoptaosd
()
# sleep(10)
# sleep(10)
tdDnodes
[
i
].
starttaosd
()
tdDnodes
[
i
].
starttaosd
()
# sleep(10)
# sleep(10)
# dnodeNumbers don't include database of schema
# dnodeNumbers don't include database of schema
if
clusterComCheck
.
checkDnodes
(
dnodeNumbers
):
if
clusterComCheck
.
checkDnodes
(
dnodeNumbers
):
...
@@ -180,7 +180,7 @@ class TDTestCase:
...
@@ -180,7 +180,7 @@ class TDTestCase:
tdLog
.
exit
(
"one or more of dnodes failed to start "
)
tdLog
.
exit
(
"one or more of dnodes failed to start "
)
# self.check3mnode()
# self.check3mnode()
stopcount
+=
1
stopcount
+=
1
for
tr
in
threads
:
for
tr
in
threads
:
tr
.
join
()
tr
.
join
()
tdLog
.
info
(
"check dnode number:"
)
tdLog
.
info
(
"check dnode number:"
)
...
@@ -196,7 +196,7 @@ class TDTestCase:
...
@@ -196,7 +196,7 @@ class TDTestCase:
def
run
(
self
):
def
run
(
self
):
# print(self.master_dnode.cfgDict)
# print(self.master_dnode.cfgDict)
self
.
fiveDnodeThreeMnode
(
dnodeNumbers
=
5
,
mnodeNums
=
3
,
restartNumbers
=
10
,
stopRole
=
'dnode'
)
self
.
fiveDnodeThreeMnode
(
dnodeNumbers
=
5
,
mnodeNums
=
3
,
restartNumbers
=
10
,
stopRole
=
'dnode'
)
...
@@ -205,4 +205,4 @@ class TDTestCase:
...
@@ -205,4 +205,4 @@ class TDTestCase:
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/system-test/6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDbRep3.py
浏览文件 @
bd5381f8
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
import
taos
import
taos
import
sys
import
sys
import
time
import
time
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
...
@@ -12,13 +12,13 @@ from util.dnodes import TDDnode
...
@@ -12,13 +12,13 @@ from util.dnodes import TDDnode
from
util.cluster
import
*
from
util.cluster
import
*
sys
.
path
.
append
(
"./6-cluster"
)
sys
.
path
.
append
(
"./6-cluster"
)
from
clusterCommonCreate
import
*
from
clusterCommonCreate
import
*
from
clusterCommonCheck
import
clusterComCheck
from
clusterCommonCheck
import
clusterComCheck
import
time
import
time
import
socket
import
socket
import
subprocess
import
subprocess
from
multiprocessing
import
Process
from
multiprocessing
import
Process
import
threading
import
threading
import
time
import
time
import
inspect
import
inspect
import
ctypes
import
ctypes
...
@@ -56,7 +56,7 @@ class TDTestCase:
...
@@ -56,7 +56,7 @@ class TDTestCase:
if
res
==
0
:
if
res
==
0
:
raise
ValueError
(
"invalid thread id"
)
raise
ValueError
(
"invalid thread id"
)
elif
res
!=
1
:
elif
res
!=
1
:
# """if it returns a number greater than one, you're in trouble,
# """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect"""
# and you should call it again with exc=NULL to revert the effect"""
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
None
)
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
None
)
raise
SystemError
(
"PyThreadState_SetAsyncExc failed"
)
raise
SystemError
(
"PyThreadState_SetAsyncExc failed"
)
...
@@ -82,13 +82,13 @@ class TDTestCase:
...
@@ -82,13 +82,13 @@ class TDTestCase:
'ctbPrefix'
:
'ctb'
,
'ctbPrefix'
:
'ctb'
,
'ctbNum'
:
1
,
'ctbNum'
:
1
,
}
}
dnodeNumbers
=
int
(
dnodeNumbers
)
dnodeNumbers
=
int
(
dnodeNumbers
)
mnodeNums
=
int
(
mnodeNums
)
mnodeNums
=
int
(
mnodeNums
)
vnodeNumbers
=
int
(
dnodeNumbers
-
mnodeNums
)
vnodeNumbers
=
int
(
dnodeNumbers
-
mnodeNums
)
allDbNumbers
=
(
paraDict
[
'dbNumbers'
]
*
restartNumbers
)
allDbNumbers
=
(
paraDict
[
'dbNumbers'
]
*
restartNumbers
)
allStbNumbers
=
(
paraDict
[
'stbNumbers'
]
*
restartNumbers
)
allStbNumbers
=
(
paraDict
[
'stbNumbers'
]
*
restartNumbers
)
tdLog
.
info
(
"first check dnode and mnode"
)
tdLog
.
info
(
"first check dnode and mnode"
)
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
...
@@ -103,14 +103,14 @@ class TDTestCase:
...
@@ -103,14 +103,14 @@ class TDTestCase:
tdSql
.
execute
(
"create mnode on dnode 3"
)
tdSql
.
execute
(
"create mnode on dnode 3"
)
clusterComCheck
.
checkMnodeStatus
(
3
)
clusterComCheck
.
checkMnodeStatus
(
3
)
# add some error operations and
# add some error operations and
tdLog
.
info
(
"Confirm the status of the dnode again"
)
tdLog
.
info
(
"Confirm the status of the dnode again"
)
tdSql
.
error
(
"create mnode on dnode 2"
)
tdSql
.
error
(
"create mnode on dnode 2"
)
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
print
(
tdSql
.
queryResult
)
print
(
tdSql
.
queryResult
)
clusterComCheck
.
checkDnodes
(
dnodeNumbers
)
clusterComCheck
.
checkDnodes
(
dnodeNumbers
)
tdLog
.
info
(
"create database and stable"
)
tdLog
.
info
(
"create database and stable"
)
tdDnodes
=
cluster
.
dnodes
tdDnodes
=
cluster
.
dnodes
stopcount
=
0
stopcount
=
0
threads
=
[]
threads
=
[]
...
@@ -122,7 +122,7 @@ class TDTestCase:
...
@@ -122,7 +122,7 @@ class TDTestCase:
for
tr
in
threads
:
for
tr
in
threads
:
tr
.
start
()
tr
.
start
()
tdLog
.
info
(
"Take turns stopping Mnodes "
)
tdLog
.
info
(
"Take turns stopping Mnodes "
)
while
stopcount
<
restartNumbers
:
while
stopcount
<
restartNumbers
:
tdLog
.
info
(
" restart loop: %d"
%
stopcount
)
tdLog
.
info
(
" restart loop: %d"
%
stopcount
)
if
stopRole
==
"mnode"
:
if
stopRole
==
"mnode"
:
...
@@ -130,7 +130,7 @@ class TDTestCase:
...
@@ -130,7 +130,7 @@ class TDTestCase:
tdDnodes
[
i
].
stoptaosd
()
tdDnodes
[
i
].
stoptaosd
()
# sleep(10)
# sleep(10)
tdDnodes
[
i
].
starttaosd
()
tdDnodes
[
i
].
starttaosd
()
# sleep(10)
# sleep(10)
elif
stopRole
==
"vnode"
:
elif
stopRole
==
"vnode"
:
for
i
in
range
(
vnodeNumbers
):
for
i
in
range
(
vnodeNumbers
):
tdDnodes
[
i
+
mnodeNums
].
stoptaosd
()
tdDnodes
[
i
+
mnodeNums
].
stoptaosd
()
...
@@ -142,7 +142,7 @@ class TDTestCase:
...
@@ -142,7 +142,7 @@ class TDTestCase:
tdDnodes
[
i
].
stoptaosd
()
tdDnodes
[
i
].
stoptaosd
()
# sleep(10)
# sleep(10)
tdDnodes
[
i
].
starttaosd
()
tdDnodes
[
i
].
starttaosd
()
# sleep(10)
# sleep(10)
# dnodeNumbers don't include database of schema
# dnodeNumbers don't include database of schema
if
clusterComCheck
.
checkDnodes
(
dnodeNumbers
):
if
clusterComCheck
.
checkDnodes
(
dnodeNumbers
):
...
@@ -153,14 +153,14 @@ class TDTestCase:
...
@@ -153,14 +153,14 @@ class TDTestCase:
tdLog
.
exit
(
"one or more of dnodes failed to start "
)
tdLog
.
exit
(
"one or more of dnodes failed to start "
)
# self.check3mnode()
# self.check3mnode()
stopcount
+=
1
stopcount
+=
1
for
tr
in
threads
:
for
tr
in
threads
:
tr
.
join
()
tr
.
join
()
tdLog
.
info
(
"check dnode number:"
)
tdLog
.
info
(
"check dnode number:"
)
clusterComCheck
.
checkDnodes
(
dnodeNumbers
)
clusterComCheck
.
checkDnodes
(
dnodeNumbers
)
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdLog
.
debug
(
"we find %d databases but exepect to create %d databases "
%
(
tdSql
.
queryRows
-
2
,
allDbNumbers
-
2
))
tdLog
.
debug
(
"we find %d databases but exepect to create %d databases "
%
(
tdSql
.
queryRows
-
2
,
allDbNumbers
-
2
))
# tdLog.info("check DB Rows:")
# tdLog.info("check DB Rows:")
# clusterComCheck.checkDbRows(allDbNumbers)
# clusterComCheck.checkDbRows(allDbNumbers)
# tdLog.info("check DB Status on by on")
# tdLog.info("check DB Status on by on")
...
@@ -168,7 +168,7 @@ class TDTestCase:
...
@@ -168,7 +168,7 @@ class TDTestCase:
# clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i))
# clusterComCheck.checkDb(paraDict['dbNumbers'],restartNumbers,dbNameIndex = '%s%d'%(paraDict["dbName"],i))
def
run
(
self
):
def
run
(
self
):
# print(self.master_dnode.cfgDict)
# print(self.master_dnode.cfgDict)
self
.
fiveDnodeThreeMnode
(
dnodeNumbers
=
5
,
mnodeNums
=
3
,
restartNumbers
=
2
,
stopRole
=
'mnode'
)
self
.
fiveDnodeThreeMnode
(
dnodeNumbers
=
5
,
mnodeNums
=
3
,
restartNumbers
=
2
,
stopRole
=
'mnode'
)
...
@@ -177,4 +177,4 @@ class TDTestCase:
...
@@ -177,4 +177,4 @@ class TDTestCase:
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/system-test/6-cluster/5dnode3mnodeSeperate1VnodeStopInsert.py
浏览文件 @
bd5381f8
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
import
taos
import
taos
import
sys
import
sys
import
time
import
time
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
...
@@ -18,7 +18,7 @@ import time
...
@@ -18,7 +18,7 @@ import time
import
socket
import
socket
import
subprocess
import
subprocess
from
multiprocessing
import
Process
from
multiprocessing
import
Process
import
threading
import
threading
import
time
import
time
import
inspect
import
inspect
import
ctypes
import
ctypes
...
@@ -54,7 +54,7 @@ class TDTestCase:
...
@@ -54,7 +54,7 @@ class TDTestCase:
if
res
==
0
:
if
res
==
0
:
raise
ValueError
(
"invalid thread id"
)
raise
ValueError
(
"invalid thread id"
)
elif
res
!=
1
:
elif
res
!=
1
:
# """if it returns a number greater than one, you're in trouble,
# """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect"""
# and you should call it again with exc=NULL to revert the effect"""
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
None
)
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
None
)
raise
SystemError
(
"PyThreadState_SetAsyncExc failed"
)
raise
SystemError
(
"PyThreadState_SetAsyncExc failed"
)
...
@@ -65,7 +65,7 @@ class TDTestCase:
...
@@ -65,7 +65,7 @@ class TDTestCase:
def
insert_data
(
self
,
countstart
,
countstop
):
def
insert_data
(
self
,
countstart
,
countstop
):
# fisrt add data : db\stable\childtable\general table
# fisrt add data : db\stable\childtable\general table
for
couti
in
range
(
countstart
,
countstop
):
for
couti
in
range
(
countstart
,
countstop
):
tdLog
.
debug
(
"drop database if exists db%d"
%
couti
)
tdLog
.
debug
(
"drop database if exists db%d"
%
couti
)
tdSql
.
execute
(
"drop database if exists db%d"
%
couti
)
tdSql
.
execute
(
"drop database if exists db%d"
%
couti
)
...
@@ -96,7 +96,7 @@ class TDTestCase:
...
@@ -96,7 +96,7 @@ class TDTestCase:
for
i
in
range
(
stableCount
):
for
i
in
range
(
stableCount
):
tdSql
.
query
(
"select count(*) from %s%d"
%
(
stbname
,
i
))
tdSql
.
query
(
"select count(*) from %s%d"
%
(
stbname
,
i
))
tdSql
.
checkData
(
0
,
0
,
rowsPerSTable
)
tdSql
.
checkData
(
0
,
0
,
rowsPerSTable
)
return
return
def
checkdnodes
(
self
,
dnodenumber
):
def
checkdnodes
(
self
,
dnodenumber
):
count
=
0
count
=
0
...
@@ -104,8 +104,8 @@ class TDTestCase:
...
@@ -104,8 +104,8 @@ class TDTestCase:
time
.
sleep
(
1
)
time
.
sleep
(
1
)
statusReadyBumber
=
0
statusReadyBumber
=
0
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
if
tdSql
.
checkRows
(
dnodenumber
)
:
if
tdSql
.
checkRows
(
dnodenumber
)
:
print
(
"dnode is %d nodes"
%
dnodenumber
)
print
(
"dnode is %d nodes"
%
dnodenumber
)
for
i
in
range
(
dnodenumber
):
for
i
in
range
(
dnodenumber
):
if
tdSql
.
queryResult
[
i
][
4
]
!=
'ready'
:
if
tdSql
.
queryResult
[
i
][
4
]
!=
'ready'
:
status
=
tdSql
.
queryResult
[
i
][
4
]
status
=
tdSql
.
queryResult
[
i
][
4
]
...
@@ -122,15 +122,15 @@ class TDTestCase:
...
@@ -122,15 +122,15 @@ class TDTestCase:
else
:
else
:
print
(
"%d mnodes is not ready in 10s "
%
dnodenumber
)
print
(
"%d mnodes is not ready in 10s "
%
dnodenumber
)
return
False
return
False
def
check3mnode
(
self
):
def
check3mnode
(
self
):
count
=
0
count
=
0
while
count
<
10
:
while
count
<
10
:
time
.
sleep
(
1
)
time
.
sleep
(
1
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
query
(
"show mnodes;"
)
if
tdSql
.
checkRows
(
3
)
:
if
tdSql
.
checkRows
(
3
)
:
print
(
"mnode is three nodes"
)
print
(
"mnode is three nodes"
)
if
tdSql
.
queryResult
[
0
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
0
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
...
@@ -140,19 +140,19 @@ class TDTestCase:
...
@@ -140,19 +140,19 @@ class TDTestCase:
if
tdSql
.
queryResult
[
1
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
print
(
"three mnodes is ready in 10s"
)
print
(
"three mnodes is ready in 10s"
)
break
break
elif
tdSql
.
queryResult
[
0
][
2
]
==
'follower'
:
elif
tdSql
.
queryResult
[
0
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'leader'
:
print
(
"three mnodes is ready in 10s"
)
print
(
"three mnodes is ready in 10s"
)
break
break
count
+=
1
count
+=
1
else
:
else
:
print
(
"three mnodes is not ready in 10s "
)
print
(
"three mnodes is not ready in 10s "
)
return
-
1
return
-
1
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
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
1
,
1
,
'%s:6130'
%
self
.
host
)
tdSql
.
checkData
(
1
,
1
,
'%s:6130'
%
self
.
host
)
...
@@ -182,8 +182,8 @@ class TDTestCase:
...
@@ -182,8 +182,8 @@ class TDTestCase:
return
-
1
return
-
1
tdSql
.
error
(
"drop mnode on dnode 1;"
)
tdSql
.
error
(
"drop mnode on dnode 1;"
)
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
,
'offline'
)
tdSql
.
checkData
(
0
,
2
,
'offline'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -210,8 +210,8 @@ class TDTestCase:
...
@@ -210,8 +210,8 @@ class TDTestCase:
return
-
1
return
-
1
tdSql
.
error
(
"drop mnode on dnode 2;"
)
tdSql
.
error
(
"drop mnode on dnode 2;"
)
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
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -239,8 +239,8 @@ class TDTestCase:
...
@@ -239,8 +239,8 @@ class TDTestCase:
print
(
"stop mnodes on dnode 3 failed in 10s"
)
print
(
"stop mnodes on dnode 3 failed in 10s"
)
return
-
1
return
-
1
tdSql
.
error
(
"drop mnode on dnode 3;"
)
tdSql
.
error
(
"drop mnode on dnode 3;"
)
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
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -258,15 +258,15 @@ class TDTestCase:
...
@@ -258,15 +258,15 @@ class TDTestCase:
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
def
five_dnode_three_mnode
(
self
,
dnodenumber
):
def
five_dnode_three_mnode
(
self
,
dnodenumber
):
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -281,15 +281,15 @@ class TDTestCase:
...
@@ -281,15 +281,15 @@ class TDTestCase:
tdSql
.
error
(
"create mnode on dnode 2"
)
tdSql
.
error
(
"create mnode on dnode 2"
)
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
print
(
tdSql
.
queryResult
)
print
(
tdSql
.
queryResult
)
tdLog
.
debug
(
"stop all of mnode "
)
tdLog
.
debug
(
"stop all of mnode "
)
# seperate vnode and mnode in different dnodes.
# seperate vnode and mnode in different dnodes.
# create database and stable
# create database and stable
stopcount
=
0
stopcount
=
0
while
stopcount
<
2
:
while
stopcount
<
2
:
for
i
in
range
(
dnodenumber
):
for
i
in
range
(
dnodenumber
):
# threads=[]
# threads=[]
# threads = MyThreadFunc(self.insert_data(i*2,i*2+2))
# threads = MyThreadFunc(self.insert_data(i*2,i*2+2))
threads
=
threading
.
Thread
(
target
=
self
.
insert_data
,
args
=
(
i
,
i
+
1
))
threads
=
threading
.
Thread
(
target
=
self
.
insert_data
,
args
=
(
i
,
i
+
1
))
threads
.
start
()
threads
.
start
()
self
.
TDDnodes
.
stoptaosd
(
i
+
1
)
self
.
TDDnodes
.
stoptaosd
(
i
+
1
)
...
@@ -306,13 +306,13 @@ class TDTestCase:
...
@@ -306,13 +306,13 @@ class TDTestCase:
return
False
return
False
# self.check3mnode()
# self.check3mnode()
self
.
check3mnode
()
self
.
check3mnode
()
stopcount
+=
1
stopcount
+=
1
self
.
check3mnode
()
self
.
check3mnode
()
def
run
(
self
):
def
run
(
self
):
# print(self.master_dnode.cfgDict)
# print(self.master_dnode.cfgDict)
self
.
five_dnode_three_mnode
(
5
)
self
.
five_dnode_three_mnode
(
5
)
...
@@ -321,4 +321,4 @@ class TDTestCase:
...
@@ -321,4 +321,4 @@ class TDTestCase:
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/system-test/6-cluster/5dnode3mnodeStopInsert.py
浏览文件 @
bd5381f8
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
...
@@ -2,7 +2,7 @@ from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
import
taos
import
taos
import
sys
import
sys
import
time
import
time
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
...
@@ -13,7 +13,7 @@ import time
...
@@ -13,7 +13,7 @@ import time
import
socket
import
socket
import
subprocess
import
subprocess
from
multiprocessing
import
Process
from
multiprocessing
import
Process
import
threading
import
threading
import
time
import
time
import
inspect
import
inspect
import
ctypes
import
ctypes
...
@@ -36,7 +36,7 @@ class TDTestCase:
...
@@ -36,7 +36,7 @@ class TDTestCase:
self
.
host
=
self
.
master_dnode
.
cfgDict
[
"fqdn"
]
self
.
host
=
self
.
master_dnode
.
cfgDict
[
"fqdn"
]
conn1
=
taos
.
connect
(
self
.
master_dnode
.
cfgDict
[
"fqdn"
]
,
config
=
self
.
master_dnode
.
cfgDir
)
conn1
=
taos
.
connect
(
self
.
master_dnode
.
cfgDict
[
"fqdn"
]
,
config
=
self
.
master_dnode
.
cfgDir
)
tdSql
.
init
(
conn1
.
cursor
())
tdSql
.
init
(
conn1
.
cursor
())
def
getBuildPath
(
self
):
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
@@ -62,7 +62,7 @@ class TDTestCase:
...
@@ -62,7 +62,7 @@ class TDTestCase:
if
res
==
0
:
if
res
==
0
:
raise
ValueError
(
"invalid thread id"
)
raise
ValueError
(
"invalid thread id"
)
elif
res
!=
1
:
elif
res
!=
1
:
# """if it returns a number greater than one, you're in trouble,
# """if it returns a number greater than one, you're in trouble,
# and you should call it again with exc=NULL to revert the effect"""
# and you should call it again with exc=NULL to revert the effect"""
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
None
)
ctypes
.
pythonapi
.
PyThreadState_SetAsyncExc
(
tid
,
None
)
raise
SystemError
(
"PyThreadState_SetAsyncExc failed"
)
raise
SystemError
(
"PyThreadState_SetAsyncExc failed"
)
...
@@ -73,7 +73,7 @@ class TDTestCase:
...
@@ -73,7 +73,7 @@ class TDTestCase:
def
insert_data
(
self
,
countstart
,
countstop
):
def
insert_data
(
self
,
countstart
,
countstop
):
# fisrt add data : db\stable\childtable\general table
# fisrt add data : db\stable\childtable\general table
for
couti
in
range
(
countstart
,
countstop
):
for
couti
in
range
(
countstart
,
countstop
):
tdLog
.
debug
(
"drop database if exists db%d"
%
couti
)
tdLog
.
debug
(
"drop database if exists db%d"
%
couti
)
tdSql
.
execute
(
"drop database if exists db%d"
%
couti
)
tdSql
.
execute
(
"drop database if exists db%d"
%
couti
)
...
@@ -95,10 +95,10 @@ class TDTestCase:
...
@@ -95,10 +95,10 @@ class TDTestCase:
for
i
in
range
(
4
):
for
i
in
range
(
4
):
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags (
{
i
+
1
}
)'
)
tdSql
.
execute
(
f
'create table ct
{
i
+
1
}
using stb1 tags (
{
i
+
1
}
)'
)
def
depoly_cluster
(
self
,
dnodes_nums
):
def
depoly_cluster
(
self
,
dnodes_nums
):
testCluster
=
False
testCluster
=
False
valgrind
=
0
valgrind
=
0
hostname
=
socket
.
gethostname
()
hostname
=
socket
.
gethostname
()
dnodes
=
[]
dnodes
=
[]
start_port
=
6030
start_port
=
6030
...
@@ -112,7 +112,7 @@ class TDTestCase:
...
@@ -112,7 +112,7 @@ class TDTestCase:
dnode
.
addExtraCfg
(
"monitorPort"
,
7043
)
dnode
.
addExtraCfg
(
"monitorPort"
,
7043
)
dnode
.
addExtraCfg
(
"secondEp"
,
f
"
{
hostname
}
:
{
start_port_sec
}
"
)
dnode
.
addExtraCfg
(
"secondEp"
,
f
"
{
hostname
}
:
{
start_port_sec
}
"
)
dnodes
.
append
(
dnode
)
dnodes
.
append
(
dnode
)
self
.
TDDnodes
=
MyDnodes
(
dnodes
)
self
.
TDDnodes
=
MyDnodes
(
dnodes
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
...
@@ -120,11 +120,11 @@ class TDTestCase:
...
@@ -120,11 +120,11 @@ class TDTestCase:
self
.
TDDnodes
.
stopAll
()
self
.
TDDnodes
.
stopAll
()
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
for
dnode
in
self
.
TDDnodes
.
dnodes
:
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
starttaosd
(
dnode
.
index
)
self
.
TDDnodes
.
starttaosd
(
dnode
.
index
)
# create cluster
# create cluster
for
dnode
in
self
.
TDDnodes
.
dnodes
[
1
:]:
for
dnode
in
self
.
TDDnodes
.
dnodes
[
1
:]:
# tdLog.debug(dnode.cfgDict)
# tdLog.debug(dnode.cfgDict)
dnode_id
=
dnode
.
cfgDict
[
"fqdn"
]
+
":"
+
dnode
.
cfgDict
[
"serverPort"
]
dnode_id
=
dnode
.
cfgDict
[
"fqdn"
]
+
":"
+
dnode
.
cfgDict
[
"serverPort"
]
...
@@ -133,7 +133,7 @@ class TDTestCase:
...
@@ -133,7 +133,7 @@ class TDTestCase:
cmd
=
f
" taos -h
{
dnode_first_host
}
-P
{
dnode_first_port
}
-s ' create dnode
\"
{
dnode_id
}
\"
' ;"
cmd
=
f
" taos -h
{
dnode_first_host
}
-P
{
dnode_first_port
}
-s ' create dnode
\"
{
dnode_id
}
\"
' ;"
tdLog
.
debug
(
cmd
)
tdLog
.
debug
(
cmd
)
os
.
system
(
cmd
)
os
.
system
(
cmd
)
time
.
sleep
(
2
)
time
.
sleep
(
2
)
tdLog
.
info
(
" create cluster with %d dnode done! "
%
dnodes_nums
)
tdLog
.
info
(
" create cluster with %d dnode done! "
%
dnodes_nums
)
...
@@ -143,8 +143,8 @@ class TDTestCase:
...
@@ -143,8 +143,8 @@ class TDTestCase:
time
.
sleep
(
1
)
time
.
sleep
(
1
)
statusReadyBumber
=
0
statusReadyBumber
=
0
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
if
tdSql
.
checkRows
(
dnodenumber
)
:
if
tdSql
.
checkRows
(
dnodenumber
)
:
tdLog
.
debug
(
"dnode is %d nodes"
%
dnodenumber
)
tdLog
.
debug
(
"dnode is %d nodes"
%
dnodenumber
)
for
i
in
range
(
dnodenumber
):
for
i
in
range
(
dnodenumber
):
if
tdSql
.
queryResult
[
i
][
4
]
!=
'ready'
:
if
tdSql
.
queryResult
[
i
][
4
]
!=
'ready'
:
status
=
tdSql
.
queryResult
[
i
][
4
]
status
=
tdSql
.
queryResult
[
i
][
4
]
...
@@ -161,15 +161,15 @@ class TDTestCase:
...
@@ -161,15 +161,15 @@ class TDTestCase:
else
:
else
:
tdLog
.
debug
(
"%d mnodes is not ready in 10s "
%
dnodenumber
)
tdLog
.
debug
(
"%d mnodes is not ready in 10s "
%
dnodenumber
)
return
False
return
False
def
check3mnode
(
self
):
def
check3mnode
(
self
):
count
=
0
count
=
0
while
count
<
10
:
while
count
<
10
:
time
.
sleep
(
1
)
time
.
sleep
(
1
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
query
(
"show mnodes;"
)
if
tdSql
.
checkRows
(
3
)
:
if
tdSql
.
checkRows
(
3
)
:
tdLog
.
debug
(
"mnode is three nodes"
)
tdLog
.
debug
(
"mnode is three nodes"
)
if
tdSql
.
queryResult
[
0
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
0
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
...
@@ -179,19 +179,19 @@ class TDTestCase:
...
@@ -179,19 +179,19 @@ class TDTestCase:
if
tdSql
.
queryResult
[
1
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'follower'
:
tdLog
.
debug
(
"three mnodes is ready in 10s"
)
tdLog
.
debug
(
"three mnodes is ready in 10s"
)
break
break
elif
tdSql
.
queryResult
[
0
][
2
]
==
'follower'
:
elif
tdSql
.
queryResult
[
0
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
1
][
2
]
==
'follower'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'leader'
:
if
tdSql
.
queryResult
[
2
][
2
]
==
'leader'
:
tdLog
.
debug
(
"three mnodes is ready in 10s"
)
tdLog
.
debug
(
"three mnodes is ready in 10s"
)
break
break
count
+=
1
count
+=
1
else
:
else
:
tdLog
.
debug
(
"three mnodes is not ready in 10s "
)
tdLog
.
debug
(
"three mnodes is not ready in 10s "
)
return
-
1
return
-
1
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
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
1
,
1
,
'%s:6130'
%
self
.
host
)
tdSql
.
checkData
(
1
,
1
,
'%s:6130'
%
self
.
host
)
...
@@ -221,8 +221,8 @@ class TDTestCase:
...
@@ -221,8 +221,8 @@ class TDTestCase:
return
-
1
return
-
1
tdSql
.
error
(
"drop mnode on dnode 1;"
)
tdSql
.
error
(
"drop mnode on dnode 1;"
)
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
,
'offline'
)
tdSql
.
checkData
(
0
,
2
,
'offline'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -249,8 +249,8 @@ class TDTestCase:
...
@@ -249,8 +249,8 @@ class TDTestCase:
return
-
1
return
-
1
tdSql
.
error
(
"drop mnode on dnode 2;"
)
tdSql
.
error
(
"drop mnode on dnode 2;"
)
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
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -278,8 +278,8 @@ class TDTestCase:
...
@@ -278,8 +278,8 @@ class TDTestCase:
tdLog
.
debug
(
"stop mnodes on dnode 3 failed in 10s"
)
tdLog
.
debug
(
"stop mnodes on dnode 3 failed in 10s"
)
return
-
1
return
-
1
tdSql
.
error
(
"drop mnode on dnode 3;"
)
tdSql
.
error
(
"drop mnode on dnode 3;"
)
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
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -296,8 +296,8 @@ class TDTestCase:
...
@@ -296,8 +296,8 @@ class TDTestCase:
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
4
,
1
,
'%s:6430'
%
self
.
host
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
0
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
checkData
(
4
,
4
,
'ready'
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
query
(
"show mnodes;"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
1
,
'%s:6030'
%
self
.
host
)
tdSql
.
checkData
(
0
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
2
,
'leader'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
tdSql
.
checkData
(
0
,
3
,
'ready'
)
...
@@ -312,13 +312,13 @@ class TDTestCase:
...
@@ -312,13 +312,13 @@ class TDTestCase:
tdSql
.
error
(
"create mnode on dnode 2"
)
tdSql
.
error
(
"create mnode on dnode 2"
)
tdSql
.
query
(
"show dnodes;"
)
tdSql
.
query
(
"show dnodes;"
)
tdLog
.
debug
(
tdSql
.
queryResult
)
tdLog
.
debug
(
tdSql
.
queryResult
)
tdLog
.
debug
(
"stop all of mnode "
)
tdLog
.
debug
(
"stop all of mnode "
)
stopcount
=
0
stopcount
=
0
while
stopcount
<=
2
:
while
stopcount
<=
2
:
for
i
in
range
(
dnodenumber
):
for
i
in
range
(
dnodenumber
):
# threads=[]
# threads=[]
# threads = MyThreadFunc(self.insert_data(i*2,i*2+2))
# threads = MyThreadFunc(self.insert_data(i*2,i*2+2))
threads
=
threading
.
Thread
(
target
=
self
.
insert_data
,
args
=
((
stopcount
+
i
)
*
2
,(
i
+
stopcount
)
*
2
+
2
))
threads
=
threading
.
Thread
(
target
=
self
.
insert_data
,
args
=
((
stopcount
+
i
)
*
2
,(
i
+
stopcount
)
*
2
+
2
))
threads
.
start
()
threads
.
start
()
self
.
TDDnodes
.
stoptaosd
(
i
+
1
)
self
.
TDDnodes
.
stoptaosd
(
i
+
1
)
...
@@ -344,7 +344,7 @@ class TDTestCase:
...
@@ -344,7 +344,7 @@ class TDTestCase:
return
taos
.
connect
(
host
=
host
,
port
=
int
(
port
),
config
=
config_dir
)
return
taos
.
connect
(
host
=
host
,
port
=
int
(
port
),
config
=
config_dir
)
def
run
(
self
):
def
run
(
self
):
# tdLog.debug(self.master_dnode.cfgDict)
# tdLog.debug(self.master_dnode.cfgDict)
self
.
buildcluster
(
5
)
self
.
buildcluster
(
5
)
self
.
five_dnode_three_mnode
(
5
)
self
.
five_dnode_three_mnode
(
5
)
...
@@ -354,4 +354,4 @@ class TDTestCase:
...
@@ -354,4 +354,4 @@ class TDTestCase:
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/system-test/6-cluster/clusterCommonCreate.py
浏览文件 @
bd5381f8
...
@@ -37,23 +37,23 @@ class ClusterComCreate:
...
@@ -37,23 +37,23 @@ class ClusterComCreate:
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
# tdSql.init(conn.cursor(), logSql) # output sql.txt file
# tdSql.init(conn.cursor(), logSql) # output sql.txt file
def
initConsumerTable
(
self
,
cdbName
=
'cdb'
):
def
initConsumerTable
(
self
,
cdbName
=
'cdb'
):
tdLog
.
info
(
"create consume database, and consume info table, and consume result table"
)
tdLog
.
info
(
"create consume database, and consume info table, and consume result table"
)
tdSql
.
query
(
"create database if not exists %s vgroups 1"
%
(
cdbName
))
tdSql
.
query
(
"create database if not exists %s vgroups 1"
%
(
cdbName
))
tdSql
.
query
(
"drop table if exists %s.consumeinfo "
%
(
cdbName
))
tdSql
.
query
(
"drop table if exists %s.consumeinfo "
%
(
cdbName
))
tdSql
.
query
(
"drop table if exists %s.consumeresult "
%
(
cdbName
))
tdSql
.
query
(
"drop table if exists %s.consumeresult "
%
(
cdbName
))
tdSql
.
query
(
"drop table if exists %s.notifyinfo "
%
(
cdbName
))
tdSql
.
query
(
"drop table if exists %s.notifyinfo "
%
(
cdbName
))
tdSql
.
query
(
"create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)"
%
cdbName
)
tdSql
.
query
(
"create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)"
%
cdbName
)
tdSql
.
query
(
"create table %s.consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)"
%
cdbName
)
tdSql
.
query
(
"create table %s.consumeresult (ts timestamp, consumerid int, consummsgcnt bigint, consumrowcnt bigint, checkresult int)"
%
cdbName
)
tdSql
.
query
(
"create table %s.notifyinfo (ts timestamp, cmdid int, consumerid int)"
%
cdbName
)
tdSql
.
query
(
"create table %s.notifyinfo (ts timestamp, cmdid int, consumerid int)"
%
cdbName
)
def
initConsumerInfoTable
(
self
,
cdbName
=
'cdb'
):
def
initConsumerInfoTable
(
self
,
cdbName
=
'cdb'
):
tdLog
.
info
(
"drop consumeinfo table"
)
tdLog
.
info
(
"drop consumeinfo table"
)
tdSql
.
query
(
"drop table if exists %s.consumeinfo "
%
(
cdbName
))
tdSql
.
query
(
"drop table if exists %s.consumeinfo "
%
(
cdbName
))
tdSql
.
query
(
"create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)"
%
cdbName
)
tdSql
.
query
(
"create table %s.consumeinfo (ts timestamp, consumerid int, topiclist binary(1024), keylist binary(1024), expectmsgcnt bigint, ifcheckdata int, ifmanualcommit int)"
%
cdbName
)
def
insertConsumerInfo
(
self
,
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifmanualcommit
,
cdbName
=
'cdb'
):
def
insertConsumerInfo
(
self
,
consumerId
,
expectrowcnt
,
topicList
,
keyList
,
ifcheckdata
,
ifmanualcommit
,
cdbName
=
'cdb'
):
sql
=
"insert into %s.consumeinfo values "
%
cdbName
sql
=
"insert into %s.consumeinfo values "
%
cdbName
sql
+=
"(now, %d, '%s', '%s', %d, %d, %d)"
%
(
consumerId
,
topicList
,
keyList
,
expectrowcnt
,
ifcheckdata
,
ifmanualcommit
)
sql
+=
"(now, %d, '%s', '%s', %d, %d, %d)"
%
(
consumerId
,
topicList
,
keyList
,
expectrowcnt
,
ifcheckdata
,
ifmanualcommit
)
tdLog
.
info
(
"consume info sql: %s"
%
sql
)
tdLog
.
info
(
"consume info sql: %s"
%
sql
)
...
@@ -68,11 +68,11 @@ class ClusterComCreate:
...
@@ -68,11 +68,11 @@ class ClusterComCreate:
break
break
else
:
else
:
time
.
sleep
(
5
)
time
.
sleep
(
5
)
for
i
in
range
(
expectRows
):
for
i
in
range
(
expectRows
):
tdLog
.
info
(
"consume id: %d, consume msgs: %d, consume rows: %d"
%
(
tdSql
.
getData
(
i
,
1
),
tdSql
.
getData
(
i
,
2
),
tdSql
.
getData
(
i
,
3
)))
tdLog
.
info
(
"consume id: %d, consume msgs: %d, consume rows: %d"
%
(
tdSql
.
getData
(
i
,
1
),
tdSql
.
getData
(
i
,
2
),
tdSql
.
getData
(
i
,
3
)))
resultList
.
append
(
tdSql
.
getData
(
i
,
3
))
resultList
.
append
(
tdSql
.
getData
(
i
,
3
))
return
resultList
return
resultList
def
startTmqSimProcess
(
self
,
pollDelay
,
dbName
,
showMsg
=
1
,
showRow
=
1
,
cdbName
=
'cdb'
,
valgrind
=
0
):
def
startTmqSimProcess
(
self
,
pollDelay
,
dbName
,
showMsg
=
1
,
showRow
=
1
,
cdbName
=
'cdb'
,
valgrind
=
0
):
...
@@ -82,14 +82,14 @@ class ClusterComCreate:
...
@@ -82,14 +82,14 @@ class ClusterComCreate:
logFile
=
cfgPath
+
'/../log/valgrind-tmq.log'
logFile
=
cfgPath
+
'/../log/valgrind-tmq.log'
shellCmd
=
'nohup valgrind --log-file='
+
logFile
shellCmd
=
'nohup valgrind --log-file='
+
logFile
shellCmd
+=
'--tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all --num-callers=20 -v --workaround-gcc296-bugs=yes '
shellCmd
+=
'--tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all --num-callers=20 -v --workaround-gcc296-bugs=yes '
if
(
platform
.
system
().
lower
()
==
'windows'
):
if
(
platform
.
system
().
lower
()
==
'windows'
):
shellCmd
=
'mintty -h never -w hide '
+
buildPath
+
'
\\
build
\\
bin
\\
tmq_sim.exe -c '
+
cfgPath
shellCmd
=
'mintty -h never -w hide '
+
buildPath
+
'
\\
build
\\
bin
\\
tmq_sim.exe -c '
+
cfgPath
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
dbName
,
showMsg
,
showRow
,
cdbName
)
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
dbName
,
showMsg
,
showRow
,
cdbName
)
shellCmd
+=
"> nul 2>&1 &"
shellCmd
+=
"> nul 2>&1 &"
else
:
else
:
shellCmd
=
'nohup '
+
buildPath
+
'/build/bin/tmq_sim -c '
+
cfgPath
shellCmd
=
'nohup '
+
buildPath
+
'/build/bin/tmq_sim -c '
+
cfgPath
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
dbName
,
showMsg
,
showRow
,
cdbName
)
shellCmd
+=
" -y %d -d %s -g %d -r %d -w %s "
%
(
pollDelay
,
dbName
,
showMsg
,
showRow
,
cdbName
)
shellCmd
+=
"> /dev/null 2>&1 &"
shellCmd
+=
"> /dev/null 2>&1 &"
tdLog
.
info
(
shellCmd
)
tdLog
.
info
(
shellCmd
)
os
.
system
(
shellCmd
)
os
.
system
(
shellCmd
)
...
@@ -142,7 +142,7 @@ class ClusterComCreate:
...
@@ -142,7 +142,7 @@ class ClusterComCreate:
tdLog
.
debug
(
"create table if not exists %s.%s_%d (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"
%
(
dbNameIndex
,
stbNameIndex
,
i
))
tdLog
.
debug
(
"create table if not exists %s.%s_%d (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"
%
(
dbNameIndex
,
stbNameIndex
,
i
))
tsql
.
execute
(
"create table if not exists %s.%s_%d (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"
%
(
dbNameIndex
,
stbNameIndex
,
i
))
tsql
.
execute
(
"create table if not exists %s.%s_%d (ts timestamp, c1 int, c2 int, c3 binary(16)) tags(t1 int, t2 binary(32))"
%
(
dbNameIndex
,
stbNameIndex
,
i
))
tdLog
.
debug
(
"complete to create %s.%s_%d"
%
(
dbNameIndex
,
stbNameIndex
,
i
))
tdLog
.
debug
(
"complete to create %s.%s_%d"
%
(
dbNameIndex
,
stbNameIndex
,
i
))
return
return
def
create_ctable
(
self
,
tsql
=
None
,
dbName
=
'dbx'
,
stbName
=
'stb'
,
ctbPrefix
=
'ctb'
,
ctbNum
=
1
):
def
create_ctable
(
self
,
tsql
=
None
,
dbName
=
'dbx'
,
stbName
=
'stb'
,
ctbPrefix
=
'ctb'
,
ctbNum
=
1
):
tsql
.
execute
(
"use %s"
%
dbName
)
tsql
.
execute
(
"use %s"
%
dbName
)
...
@@ -153,14 +153,14 @@ class ClusterComCreate:
...
@@ -153,14 +153,14 @@ class ClusterComCreate:
tagValue
=
'beijing'
tagValue
=
'beijing'
if
(
i
%
2
==
0
):
if
(
i
%
2
==
0
):
tagValue
=
'shanghai'
tagValue
=
'shanghai'
sql
+=
" %s_%d using %s tags(%d, '%s')"
%
(
ctbPrefix
,
i
,
stbName
,
i
+
1
,
tagValue
)
sql
+=
" %s_%d using %s tags(%d, '%s')"
%
(
ctbPrefix
,
i
,
stbName
,
i
+
1
,
tagValue
)
if
(
i
>
0
)
and
(
i
%
100
==
0
):
if
(
i
>
0
)
and
(
i
%
100
==
0
):
tsql
.
execute
(
sql
)
tsql
.
execute
(
sql
)
sql
=
pre_create
sql
=
pre_create
if
sql
!=
pre_create
:
if
sql
!=
pre_create
:
tsql
.
execute
(
sql
)
tsql
.
execute
(
sql
)
tdLog
.
debug
(
"complete to create %d child tables in %s.%s"
%
(
ctbNum
,
dbName
,
stbName
))
tdLog
.
debug
(
"complete to create %d child tables in %s.%s"
%
(
ctbNum
,
dbName
,
stbName
))
return
return
...
@@ -189,7 +189,7 @@ class ClusterComCreate:
...
@@ -189,7 +189,7 @@ class ClusterComCreate:
#print("insert sql:%s"%sql)
#print("insert sql:%s"%sql)
tsql
.
execute
(
sql
)
tsql
.
execute
(
sql
)
tdLog
.
debug
(
"insert data ............ [OK]"
)
tdLog
.
debug
(
"insert data ............ [OK]"
)
return
return
def
insert_data_1
(
self
,
tsql
,
dbName
,
ctbPrefix
,
ctbNum
,
rowsPerTbl
,
batchNum
,
startTs
):
def
insert_data_1
(
self
,
tsql
,
dbName
,
ctbPrefix
,
ctbNum
,
rowsPerTbl
,
batchNum
,
startTs
):
tdLog
.
debug
(
"start to insert data ............"
)
tdLog
.
debug
(
"start to insert data ............"
)
...
@@ -235,7 +235,7 @@ class ClusterComCreate:
...
@@ -235,7 +235,7 @@ class ClusterComCreate:
ctbDict
[
i
]
=
0
ctbDict
[
i
]
=
0
#tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows))
#tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows))
rowsOfCtb
=
0
rowsOfCtb
=
0
while
rowsOfCtb
<
rowsPerTbl
:
while
rowsOfCtb
<
rowsPerTbl
:
for
i
in
range
(
ctbNum
):
for
i
in
range
(
ctbNum
):
sql
+=
" %s.%s_%d values "
%
(
dbName
,
ctbPrefix
,
i
)
sql
+=
" %s.%s_%d values "
%
(
dbName
,
ctbPrefix
,
i
)
...
@@ -262,7 +262,7 @@ class ClusterComCreate:
...
@@ -262,7 +262,7 @@ class ClusterComCreate:
startTs
=
int
(
round
(
t
*
1000
))
startTs
=
int
(
round
(
t
*
1000
))
#tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows))
#tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows))
rowsOfSql
=
0
rowsOfSql
=
0
for
i
in
range
(
ctbNum
):
for
i
in
range
(
ctbNum
):
sql
+=
" %s.%s_%d using %s.%s tags (%d) values "
%
(
dbName
,
ctbPrefix
,
i
,
dbName
,
stbName
,
i
)
sql
+=
" %s.%s_%d using %s.%s tags (%d) values "
%
(
dbName
,
ctbPrefix
,
i
,
dbName
,
stbName
,
i
)
for
j
in
range
(
rowsPerTbl
):
for
j
in
range
(
rowsPerTbl
):
...
@@ -294,7 +294,7 @@ class ClusterComCreate:
...
@@ -294,7 +294,7 @@ class ClusterComCreate:
for
i
in
range
(
ctbNum
):
for
i
in
range
(
ctbNum
):
tbName
=
'%s%s'
%
(
ctbPrefix
,
i
)
tbName
=
'%s%s'
%
(
ctbPrefix
,
i
)
tdCom
.
insert_rows
(
tsql
,
dbname
=
paraDict
[
"dbName"
],
tbname
=
tbName
,
start_ts_value
=
paraDict
[
'startTs'
],
count
=
paraDict
[
'rowsPerTbl'
])
tdCom
.
insert_rows
(
tsql
,
dbname
=
paraDict
[
"dbName"
],
tbname
=
tbName
,
start_ts_value
=
paraDict
[
'startTs'
],
count
=
paraDict
[
'rowsPerTbl'
])
return
return
def
threadFunction
(
self
,
**
paraDict
):
def
threadFunction
(
self
,
**
paraDict
):
# create new connector for new tdSql instance in my thread
# create new connector for new tdSql instance in my thread
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录