Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f927752a
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看板
未验证
提交
f927752a
编写于
5月 18, 2023
作者:
H
Hui Li
提交者:
GitHub
5月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21317 from taosdata/test/TS-3333-3.0
test: add cluster global tdDnodes
上级
48dd3753
9a9e7fa5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
410 addition
and
4 deletion
+410
-4
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+5
-0
tests/pytest/util/autogen.py
tests/pytest/util/autogen.py
+2
-2
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+1
-2
tests/system-test/3-enterprise/restore/restoreBasic.py
tests/system-test/3-enterprise/restore/restoreBasic.py
+237
-0
tests/system-test/3-enterprise/restore/restoreDnode.py
tests/system-test/3-enterprise/restore/restoreDnode.py
+41
-0
tests/system-test/3-enterprise/restore/restoreMnode.py
tests/system-test/3-enterprise/restore/restoreMnode.py
+42
-0
tests/system-test/3-enterprise/restore/restoreQnode.py
tests/system-test/3-enterprise/restore/restoreQnode.py
+41
-0
tests/system-test/3-enterprise/restore/restoreVnode.py
tests/system-test/3-enterprise/restore/restoreVnode.py
+41
-0
未找到文件。
tests/parallel_test/cases.task
浏览文件 @
f927752a
...
...
@@ -479,6 +479,11 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreDnode.py -N 5 -M 3
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreVnode.py -N 5 -M 3
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreMnode.py -N 5 -M 3
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreQnode.py -N 5 -M 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/create_wrong_topic.py
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/basic5.py
...
...
tests/pytest/util/autogen.py
浏览文件 @
f927752a
...
...
@@ -93,9 +93,9 @@ class AutoGen:
return
''
.
join
(
random
.
choice
(
letters
)
for
i
in
range
(
count
))
# create db
def
create_db
(
self
,
dbname
):
def
create_db
(
self
,
dbname
,
vgroups
=
2
,
replica
=
1
):
self
.
dbname
=
dbname
tdSql
.
execute
(
f
'create database
{
dbname
}
'
)
tdSql
.
execute
(
f
'create database
{
dbname
}
vgroups
{
vgroups
}
replica
{
replica
}
'
)
tdSql
.
execute
(
f
'use
{
dbname
}
'
)
# create table or stable
...
...
tests/pytest/util/dnodes.py
浏览文件 @
f927752a
...
...
@@ -859,5 +859,4 @@ class TDDnodes:
def
getAsan
(
self
):
return
self
.
asan
tdDnodes
=
TDDnodes
()
tdDnodes
=
TDDnodes
()
\ No newline at end of file
tests/system-test/3-enterprise/restore/restoreBasic.py
0 → 100644
浏览文件 @
f927752a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
from
util.sqlset
import
*
from
util.dnodes
import
*
from
util.autogen
import
*
from
util.cluster
import
*
import
random
import
os
import
subprocess
import
shutil
import
time
class
RestoreBasic
:
# init
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
tdSql
.
init
(
conn
.
cursor
())
self
.
dnodes_num
=
5
# get from global
# test
self
.
dnodes
=
cluster
.
dnodes
num
=
len
(
self
.
dnodes
)
if
num
<
self
.
dnodes_num
:
tdLog
.
exit
(
f
" cluster dnode is less than
{
self
.
dnodes_num
}
. num=
{
num
}
"
)
# create data
self
.
dbname
=
"db"
self
.
stable
=
"st"
self
.
child_count
=
100
self
.
insert_rows
=
10000
self
.
create_data
()
# create data
def
create_data
(
self
):
gen
=
AutoGen
()
gen
.
create_db
(
self
.
dbname
,
8
,
3
)
gen
.
create_stable
(
self
.
stable
,
5
,
10
,
8
,
8
)
gen
.
create_child
(
self
.
stable
,
"d"
,
self
.
child_count
)
gen
.
set_batch_size
(
1000
)
gen
.
insert_data
(
self
.
insert_rows
)
tdSql
.
execute
(
f
"flush database
{
self
.
dbname
}
"
)
# put some duplicate ts on wal
gen
.
insert_data
(
self
.
insert_rows
%
100
)
for
i
in
range
(
self
.
dnodes_num
):
sql
=
f
"create qnode on dnode
{
i
+
1
}
"
tdSql
.
execute
(
sql
)
# status
def
check_status_corrent
(
self
):
# query
tdSql
.
query
(
f
" show
{
self
.
dbname
}
.vgroups"
)
# check 8 vgroups
tdSql
.
checkRows
(
8
)
# check data corrent
for
i
in
range
(
8
):
leader
=
False
for
j
in
range
(
3
):
status
=
tdSql
.
getData
(
i
,
4
+
j
*
2
)
if
status
==
"leader"
:
leader
=
True
elif
status
==
"follower"
:
pass
else
:
tdLog
.
info
(
f
" check vgroups status not leader or follower. i=
{
i
}
j=
{
j
}
status=
{
status
}
"
)
return
False
# check leader
if
leader
==
False
:
tdLog
.
info
(
f
" check vgroups not found leader i=
{
i
}
"
)
return
False
# info
tdLog
.
info
(
"check vgroups status successfully."
)
return
True
# check data corrent
def
check_corrent
(
self
):
# check status
status
=
False
for
i
in
range
(
100
):
if
self
.
check_status_corrent
():
status
=
True
break
else
:
time
.
sleep
(
0.5
)
tdLog
.
info
(
f
"sleep 500ms retry
{
i
}
to check status again..."
)
if
status
==
False
:
tdLog
.
exit
(
"check vgroups status failed, exit."
)
# check rows count
sql
=
f
"select count(ts) from
{
self
.
dbname
}
.
{
self
.
stable
}
"
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
self
.
child_count
*
self
.
insert_rows
)
# restore dnode
def
restore_dnode
(
self
,
index
):
tdLog
.
info
(
f
"start restore dnode
{
index
}
"
)
dnode
=
self
.
dnodes
[
index
-
1
]
# stop dnode
tdLog
.
info
(
f
"stop dnode
{
index
}
"
)
dnode
.
stoptaosd
()
# remove dnode folder
try
:
shutil
.
rmtree
(
dnode
.
dataDir
)
tdLog
.
info
(
f
"delete dir
{
dnode
.
dataDir
}
successful"
)
except
OSError
as
x
:
tdLog
.
exit
(
f
"remove path
{
dnode
.
dataDir
}
error :
{
x
.
strerror
}
"
)
dnode
.
starttaosd
()
# exec restore
sql
=
f
"restore dnode
{
index
}
"
tdLog
.
info
(
sql
)
tdSql
.
execute
(
sql
)
self
.
check_corrent
()
# restore vnode
def
restore_vnode
(
self
,
index
):
tdLog
.
info
(
f
"start restore vnode on dnode
{
index
}
"
)
dnode
=
self
.
dnodes
[
index
-
1
]
del_dir
=
f
"
{
dnode
.
dataDir
}
/vnode"
# stop dnode
tdLog
.
info
(
f
"stop dnode
{
index
}
"
)
dnode
.
stoptaosd
()
# remove dnode folder
try
:
shutil
.
rmtree
(
del_dir
)
tdLog
.
info
(
f
"delete dir
{
del_dir
}
successful"
)
except
OSError
as
x
:
tdLog
.
exit
(
f
"remove path
{
del_dir
}
error :
{
x
.
strerror
}
"
)
dnode
.
starttaosd
()
# exec restore
sql
=
f
"restore vnode on dnode
{
index
}
"
tdLog
.
info
(
sql
)
tdSql
.
execute
(
sql
)
# check result
self
.
check_corrent
()
# restore mnode
def
restore_mnode
(
self
,
index
):
tdLog
.
info
(
f
"start restore mnode
{
index
}
"
)
dnode
=
self
.
dnodes
[
index
-
1
]
del_dir
=
f
"
{
dnode
.
dataDir
}
/mnode"
# stop dnode
tdLog
.
info
(
f
"stop dnode
{
index
}
"
)
dnode
.
stoptaosd
()
# remove dnode folder
try
:
shutil
.
rmtree
(
del_dir
)
tdLog
.
info
(
f
"delete dir
{
del_dir
}
successful"
)
except
OSError
as
x
:
tdLog
.
exit
(
f
"remove path
{
del_dir
}
error :
{
x
.
strerror
}
"
)
dnode
.
starttaosd
()
# exec restore
sql
=
f
"restore mnode on dnode
{
index
}
"
tdLog
.
info
(
sql
)
tdSql
.
execute
(
sql
)
self
.
check_corrent
()
# restore qnode
def
restore_qnode
(
self
,
index
):
tdLog
.
info
(
f
"start restore qnode on dnode
{
index
}
"
)
dnode
=
self
.
dnodes
[
index
-
1
]
del_dir
=
f
"
{
dnode
.
dataDir
}
/qnode"
# stop dnode
tdLog
.
info
(
f
"stop dnode
{
index
}
"
)
dnode
.
stoptaosd
()
# remove dnode folder
try
:
shutil
.
rmtree
(
del_dir
)
tdLog
.
info
(
f
"delete dir
{
del_dir
}
successful"
)
except
OSError
as
x
:
tdLog
.
exit
(
f
"remove path
{
del_dir
}
error :
{
x
.
strerror
}
"
)
# start dnode
dnode
.
starttaosd
()
# exec restore
sql
=
f
"restore qnode on dnode
{
index
}
"
tdLog
.
info
(
sql
)
tdSql
.
execute
(
sql
)
self
.
check_corrent
()
# path exist
qfile
=
f
"
{
del_dir
}
/qnode.json"
if
os
.
path
.
exists
(
qfile
)
==
False
:
tdLog
.
exit
(
f
"qnode restore failed. qnode.json is not exist.
{
qfile
}
"
)
else
:
tdLog
.
info
(
f
"check qnode.json restore ok.
{
qfile
}
"
)
# stop
def
stop
(
self
):
tdSql
.
close
()
tests/system-test/3-enterprise/restore/restoreDnode.py
0 → 100644
浏览文件 @
f927752a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
sys
.
path
.
append
(
"./3-enterprise/restore"
)
from
restoreBasic
import
*
class
TDTestCase
:
# init
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
self
.
basic
=
RestoreBasic
()
self
.
basic
.
init
(
conn
,
logSql
,
replicaVar
)
# run
def
run
(
self
):
self
.
basic
.
restore_dnode
(
2
)
# stop
def
stop
(
self
):
self
.
basic
.
stop
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/3-enterprise/restore/restoreMnode.py
0 → 100644
浏览文件 @
f927752a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
sys
.
path
.
append
(
"./3-enterprise/restore"
)
from
restoreBasic
import
*
class
TDTestCase
:
# init
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
self
.
basic
=
RestoreBasic
()
self
.
basic
.
init
(
conn
,
logSql
,
replicaVar
)
# run
def
run
(
self
):
self
.
basic
.
restore_mnode
(
3
)
# stop
def
stop
(
self
):
self
.
basic
.
stop
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/3-enterprise/restore/restoreQnode.py
0 → 100644
浏览文件 @
f927752a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
sys
.
path
.
append
(
"./3-enterprise/restore"
)
from
restoreBasic
import
*
class
TDTestCase
:
# init
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
self
.
basic
=
RestoreBasic
()
self
.
basic
.
init
(
conn
,
logSql
,
replicaVar
)
# run
def
run
(
self
):
self
.
basic
.
restore_qnode
(
5
)
# stop
def
stop
(
self
):
self
.
basic
.
stop
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/3-enterprise/restore/restoreVnode.py
0 → 100644
浏览文件 @
f927752a
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
sys
.
path
.
append
(
"./3-enterprise/restore"
)
from
restoreBasic
import
*
class
TDTestCase
:
# init
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
self
.
basic
=
RestoreBasic
()
self
.
basic
.
init
(
conn
,
logSql
,
replicaVar
)
# run
def
run
(
self
):
self
.
basic
.
restore_vnode
(
4
)
# stop
def
stop
(
self
):
self
.
basic
.
stop
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录