Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8ba93cf9
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8ba93cf9
编写于
10月 31, 2022
作者:
haoranc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test:add replica 3 for all testcases and frameworks
上级
5c759908
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
18 deletion
+63
-18
tests/develop-test/test.py
tests/develop-test/test.py
+63
-18
未找到文件。
tests/develop-test/test.py
浏览文件 @
8ba93cf9
...
...
@@ -72,8 +72,9 @@ if __name__ == "__main__":
queryPolicy
=
1
createDnodeNums
=
1
restful
=
False
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:'
,
[
'file='
,
'path='
,
'master'
,
'logSql'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
,
'restart'
,
'updateCfgDict'
,
'killv'
,
'execCmd'
,
'dnodeNums'
,
'mnodeNums'
,
'queryPolicy'
,
'createDnodeNums'
,
'restful'
,
'adaptercfgupdate'
])
replicaVar
=
1
opts
,
args
=
getopt
.
gnu_getopt
(
sys
.
argv
[
1
:],
'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:'
,
[
'file='
,
'path='
,
'master'
,
'logSql'
,
'stop'
,
'cluster'
,
'valgrind'
,
'help'
,
'restart'
,
'updateCfgDict'
,
'killv'
,
'execCmd'
,
'dnodeNums'
,
'mnodeNums'
,
'queryPolicy'
,
'createDnodeNums'
,
'restful'
,
'adaptercfgupdate'
,
'replicaVar'
])
for
key
,
value
in
opts
:
if
key
in
[
'-h'
,
'--help'
]:
tdLog
.
printNoPrefix
(
...
...
@@ -95,8 +96,7 @@ if __name__ == "__main__":
tdLog
.
printNoPrefix
(
'-C create Dnode Numbers in one cluster'
)
tdLog
.
printNoPrefix
(
'-R restful realization form'
)
tdLog
.
printNoPrefix
(
'-D taosadapter update cfg dict '
)
tdLog
.
printNoPrefix
(
'-n the number of replicas'
)
sys
.
exit
(
0
)
if
key
in
[
'-r'
,
'--restart'
]:
...
...
@@ -168,6 +168,9 @@ if __name__ == "__main__":
print
(
'adapter cfg update convert fail.'
)
sys
.
exit
(
0
)
if
key
in
[
'-n'
,
'--replicaVar'
]:
replicaVar
=
value
if
not
execCmd
==
""
:
if
restful
:
tAdapter
.
init
(
deployPath
)
...
...
@@ -194,7 +197,7 @@ if __name__ == "__main__":
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
for
port
in
range
(
6030
,
6041
):
usePortPID
=
"lsof -i tcp:%d | grep LISTE
n
| awk '{print $2}'"
%
port
usePortPID
=
"lsof -i tcp:%d | grep LISTE
N
| awk '{print $2}'"
%
port
processID
=
subprocess
.
check_output
(
usePortPID
,
shell
=
True
)
if
processID
:
...
...
@@ -206,11 +209,13 @@ if __name__ == "__main__":
time
.
sleep
(
2
)
if
restful
:
toBeKilled
=
"taosadapt
er
"
toBeKilled
=
"taosadapt"
killCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1"
%
toBeKilled
# killCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1" % toBeKilled
killCmd
=
f
"pkill
{
toBeKilled
}
"
psCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}'"
%
toBeKilled
# psCmd = f"pgrep {toBeKilled}"
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
while
(
processID
):
...
...
@@ -218,15 +223,15 @@ if __name__ == "__main__":
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
)
for
port
in
range
(
6030
,
6041
):
usePortPID
=
"lsof -i tcp:%d | grep LISTEn | awk '{print $2}'"
%
port
processID
=
subprocess
.
check_output
(
usePortPID
,
shell
=
True
)
port
=
6041
usePortPID
=
f
"lsof -i tcp:
{
port
}
| grep LISTEN | awk '{{print $2}}'"
processID
=
subprocess
.
check_output
(
usePortPID
,
shell
=
True
)
if
processID
:
killCmd
=
"kill -TERM %s"
%
processID
os
.
system
(
killCmd
)
fuserCmd
=
"fuser -k -n tcp %d"
%
port
os
.
system
(
fuserCmd
)
if
processID
:
killCmd
=
f
"kill -TERM
{
processID
}
"
os
.
system
(
killCmd
)
fuserCmd
=
f
"fuser -k -n tcp
{
port
}
"
os
.
system
(
fuserCmd
)
tdLog
.
info
(
'stop taosadapter'
)
...
...
@@ -319,7 +324,7 @@ if __name__ == "__main__":
for
dnode
in
tdDnodes
.
dnodes
:
tdDnodes
.
starttaosd
(
dnode
.
index
)
tdCases
.
logSql
(
logSql
)
if
restful
:
tAdapter
.
deploy
(
adapter_cfg_dict
)
tAdapter
.
start
()
...
...
@@ -339,6 +344,26 @@ if __name__ == "__main__":
print
(
"check dnode ready"
)
except
Exception
as
r
:
print
(
r
)
if
queryPolicy
!=
1
:
queryPolicy
=
int
(
queryPolicy
)
if
restful
:
conn
=
taosrest
.
connect
(
url
=
f
"http://
{
host
}
:6041"
)
else
:
conn
=
taos
.
connect
(
host
,
config
=
tdDnodes
.
getSimCfgPath
())
cursor
=
conn
.
cursor
()
cursor
.
execute
(
"create qnode on dnode 1"
)
cursor
.
execute
(
f
'alter local "queryPolicy" "
{
queryPolicy
}
"'
)
cursor
.
execute
(
"show local variables"
)
res
=
cursor
.
fetchall
()
for
i
in
range
(
cursor
.
rowcount
):
if
res
[
i
][
0
]
==
"queryPolicy"
:
if
int
(
res
[
i
][
1
])
==
int
(
queryPolicy
):
tdLog
.
success
(
f
'alter queryPolicy to
{
queryPolicy
}
successfully'
)
else
:
tdLog
.
debug
(
res
)
tdLog
.
exit
(
f
"alter queryPolicy to
{
queryPolicy
}
failed"
)
if
ucase
is
not
None
and
hasattr
(
ucase
,
'noConn'
)
and
ucase
.
noConn
==
True
:
conn
=
None
else
:
...
...
@@ -453,6 +478,26 @@ if __name__ == "__main__":
except
Exception
as
r
:
print
(
r
)
if
queryPolicy
!=
1
:
queryPolicy
=
int
(
queryPolicy
)
if
restful
:
conn
=
taosrest
.
connect
(
url
=
f
"http://
{
host
}
:6041"
)
else
:
conn
=
taos
.
connect
(
host
,
config
=
tdDnodes
.
getSimCfgPath
())
cursor
=
conn
.
cursor
()
cursor
.
execute
(
"create qnode on dnode 1"
)
cursor
.
execute
(
f
'alter local "queryPolicy" "
{
queryPolicy
}
"'
)
cursor
.
execute
(
"show local variables"
)
res
=
cursor
.
fetchall
()
for
i
in
range
(
cursor
.
rowcount
):
if
res
[
i
][
0
]
==
"queryPolicy"
:
if
int
(
res
[
i
][
1
])
==
int
(
queryPolicy
):
tdLog
.
success
(
f
'alter queryPolicy to
{
queryPolicy
}
successfully'
)
else
:
tdLog
.
debug
(
res
)
tdLog
.
exit
(
f
"alter queryPolicy to
{
queryPolicy
}
failed"
)
if
testCluster
:
tdLog
.
info
(
"Procedures for testing cluster"
)
...
...
@@ -470,7 +515,7 @@ if __name__ == "__main__":
if
fileName
==
"all"
:
tdCases
.
runAllLinux
(
conn
)
else
:
tdCases
.
runOneLinux
(
conn
,
fileName
)
tdCases
.
runOneLinux
(
conn
,
fileName
,
replicaVar
)
if
restart
:
if
fileName
==
"all"
:
...
...
@@ -487,7 +532,7 @@ if __name__ == "__main__":
conn
=
taosrest
.
connect
(
url
=
f
"http://
{
host
}
:6041"
)
tdLog
.
info
(
"Procedures for tdengine deployed in %s"
%
(
host
))
tdLog
.
info
(
"query test after taosd restart"
)
tdCases
.
runOneLinux
(
conn
,
sp
[
0
]
+
"_"
+
"restart.py"
)
tdCases
.
runOneLinux
(
conn
,
sp
[
0
]
+
"_"
+
"restart.py"
,
replicaVar
)
else
:
tdLog
.
info
(
"not need to query"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录