Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b1a2dff6
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1181
Star
22014
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,发现更多精彩内容 >>
提交
b1a2dff6
编写于
6月 11, 2022
作者:
haoranc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test:add dnode of clusters
上级
544e3f7f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
120 addition
and
0 deletion
+120
-0
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+120
-0
未找到文件。
tests/pytest/util/dnodes.py
浏览文件 @
b1a2dff6
...
...
@@ -287,6 +287,88 @@ class TDDnode:
return
""
return
paths
[
0
]
def
starttaosd
(
self
):
binPath
=
self
.
getPath
()
if
(
binPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found: %s"
%
binPath
)
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
if
self
.
valgrind
==
0
:
if
platform
.
system
().
lower
()
==
'windows'
:
cmd
=
"mintty -h never -w hide %s -c %s"
%
(
binPath
,
self
.
cfgDir
)
else
:
cmd
=
"nohup %s -c %s > /dev/null 2>&1 & "
%
(
binPath
,
self
.
cfgDir
)
else
:
valgrindCmdline
=
"valgrind --log-file=
\"
%s/../log/valgrind.log
\"
--tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
%
self
.
cfgDir
if
platform
.
system
().
lower
()
==
'windows'
:
cmd
=
"mintty -h never -w hide %s %s -c %s"
%
(
valgrindCmdline
,
binPath
,
self
.
cfgDir
)
else
:
cmd
=
"nohup %s %s -c %s 2>&1 & "
%
(
valgrindCmdline
,
binPath
,
self
.
cfgDir
)
print
(
cmd
)
if
(
not
self
.
remoteIP
==
""
):
self
.
remoteExec
(
self
.
cfgDict
,
"tdDnodes.dnodes[%d].deployed=1
\n
tdDnodes.dnodes[%d].logDir=
\"
%%s/sim/dnode%%d/log
\"
%%(tdDnodes.dnodes[%d].path,%d)
\n
tdDnodes.dnodes[%d].cfgDir=
\"
%%s/sim/dnode%%d/cfg
\"
%%(tdDnodes.dnodes[%d].path,%d)
\n
tdDnodes.start(%d)"
%
(
self
.
index
-
1
,
self
.
index
-
1
,
self
.
index
-
1
,
self
.
index
,
self
.
index
-
1
,
self
.
index
-
1
,
self
.
index
,
self
.
index
))
self
.
running
=
1
else
:
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
self
.
running
=
1
print
(
"dnode:%d is running with %s "
%
(
self
.
index
,
cmd
))
tdLog
.
debug
(
"dnode:%d is running with %s "
%
(
self
.
index
,
cmd
))
if
self
.
valgrind
==
0
:
time
.
sleep
(
0.1
)
key1
=
'from offline to online'
bkey1
=
bytes
(
key1
,
encoding
=
"utf8"
)
key2
=
'TDengine initialized successfully'
bkey2
=
bytes
(
key2
,
encoding
=
"utf8"
)
logFile
=
self
.
logDir
+
"/taosdlog.0"
i
=
0
while
not
os
.
path
.
exists
(
logFile
):
sleep
(
0.1
)
i
+=
1
if
i
>
10
:
break
tailCmdStr
=
'tail -f '
if
platform
.
system
().
lower
()
==
'windows'
:
tailCmdStr
=
'tail -n +0 -f '
popen
=
subprocess
.
Popen
(
tailCmdStr
+
logFile
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
shell
=
True
)
pid
=
popen
.
pid
# print('Popen.pid:' + str(pid))
timeout
=
time
.
time
()
+
60
*
2
# while True:
# line = popen.stdout.readline().strip()
# print(line)
# if bkey1 in line:
# popen.kill()
# break
# elif bkey2 in line:
# popen.kill()
# break
# if time.time() > timeout:
# print(time.time(),timeout)
# tdLog.exit('wait too long for taosd start')
tdLog
.
debug
(
"the dnode:%d has been started."
%
(
self
.
index
))
else
:
tdLog
.
debug
(
"wait 10 seconds for the dnode:%d to start."
%
(
self
.
index
))
time
.
sleep
(
10
)
def
start
(
self
):
binPath
=
self
.
getPath
()
...
...
@@ -424,6 +506,35 @@ class TDDnode:
self
.
running
=
0
tdLog
.
debug
(
"dnode:%d is stopped by kill -INT"
%
(
self
.
index
))
def
stoptaosd
(
self
):
if
(
not
self
.
remoteIP
==
""
):
print
(
"123"
)
self
.
remoteExec
(
self
.
cfgDict
,
"tdDnodes.dnodes[%d].running=1
\n
tdDnodes.dnodes[%d].stop()"
%
(
self
.
index
-
1
,
self
.
index
-
1
))
tdLog
.
info
(
"stop dnode%d"
%
self
.
index
)
return
if
self
.
valgrind
==
0
:
toBeKilled
=
"taosd"
else
:
toBeKilled
=
"valgrind.bin"
if
self
.
running
!=
0
:
psCmd
=
"ps -ef|grep -w %s| grep dnode%d|grep -v grep | awk '{print $2}'"
%
(
toBeKilled
,
self
.
index
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
while
(
processID
):
killCmd
=
"kill -INT %s > /dev/null 2>&1"
%
processID
os
.
system
(
killCmd
)
time
.
sleep
(
1
)
processID
=
subprocess
.
check_output
(
psCmd
,
shell
=
True
).
decode
(
"utf-8"
)
if
self
.
valgrind
:
time
.
sleep
(
2
)
self
.
running
=
0
tdLog
.
debug
(
"dnode:%d is stopped by kill -INT"
%
(
self
.
index
))
def
forcestop
(
self
):
if
(
not
self
.
remoteIP
==
""
):
self
.
remoteExec
(
self
.
cfgDict
,
"tdDnodes.dnodes[%d].running=1
\n
tdDnodes.dnodes[%d].forcestop()"
%
(
self
.
index
-
1
,
self
.
index
-
1
))
...
...
@@ -536,6 +647,15 @@ class TDDnodes:
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
cfg
(
option
,
value
)
def
starttaosd
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
starttaosd
()
def
stoptaosd
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
stoptaosd
()
def
start
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
start
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录