Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3b9e9772
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
3b9e9772
编写于
4月 15, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: reopen dbTest
上级
5143c8db
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
125 deletion
+28
-125
source/dnode/mnode/impl/test/db/CMakeLists.txt
source/dnode/mnode/impl/test/db/CMakeLists.txt
+4
-4
source/dnode/mnode/impl/test/db/db.cpp
source/dnode/mnode/impl/test/db/db.cpp
+24
-121
未找到文件。
source/dnode/mnode/impl/test/db/CMakeLists.txt
浏览文件 @
3b9e9772
...
...
@@ -5,7 +5,7 @@ target_link_libraries(
PUBLIC sut
)
#
add_test(
# NAME mnode_test_db
# COMMAND mnode_test_db
#
)
add_test
(
NAME dbTest
COMMAND dbTest
)
source/dnode/mnode/impl/test/db/db.cpp
浏览文件 @
3b9e9772
...
...
@@ -26,29 +26,8 @@ class MndTestDb : public ::testing::Test {
Testbase
MndTestDb
::
test
;
TEST_F
(
MndTestDb
,
01
_ShowDb
)
{
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
17
);
CHECK_SCHEMA
(
0
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
-
1
+
VARSTR_HEADER_SIZE
,
"name"
);
CHECK_SCHEMA
(
1
,
TSDB_DATA_TYPE_TIMESTAMP
,
8
,
"create_time"
);
CHECK_SCHEMA
(
2
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"vgroups"
);
CHECK_SCHEMA
(
3
,
TSDB_DATA_TYPE_INT
,
4
,
"ntables"
);
CHECK_SCHEMA
(
4
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"replica"
);
CHECK_SCHEMA
(
5
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"quorum"
);
CHECK_SCHEMA
(
6
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"days"
);
CHECK_SCHEMA
(
7
,
TSDB_DATA_TYPE_BINARY
,
24
+
VARSTR_HEADER_SIZE
,
"keep0,keep1,keep2"
);
CHECK_SCHEMA
(
8
,
TSDB_DATA_TYPE_INT
,
4
,
"cache"
);
CHECK_SCHEMA
(
9
,
TSDB_DATA_TYPE_INT
,
4
,
"blocks"
);
CHECK_SCHEMA
(
10
,
TSDB_DATA_TYPE_INT
,
4
,
"minrows"
);
CHECK_SCHEMA
(
11
,
TSDB_DATA_TYPE_INT
,
4
,
"maxrows"
);
CHECK_SCHEMA
(
12
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"wallevel"
);
CHECK_SCHEMA
(
13
,
TSDB_DATA_TYPE_INT
,
4
,
"fsync"
);
CHECK_SCHEMA
(
14
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"comp"
);
CHECK_SCHEMA
(
15
,
TSDB_DATA_TYPE_TINYINT
,
1
,
"cachelast"
);
CHECK_SCHEMA
(
16
,
TSDB_DATA_TYPE_BINARY
,
3
+
VARSTR_HEADER_SIZE
,
"precision"
);
// CHECK_SCHEMA(17, TSDB_DATA_TYPE_TINYINT, 1, "update");
test
.
SendShowRetrieveReq
();
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"user_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
TEST_F
(
MndTestDb
,
02
_Create_Alter_Drop_Db
)
{
...
...
@@ -58,7 +37,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
createReq
.
numOfVgroups
=
2
;
createReq
.
cacheBlockSize
=
16
;
createReq
.
totalBlocks
=
10
;
createReq
.
daysPerFile
=
10
;
createReq
.
daysPerFile
=
10
00
;
createReq
.
daysToKeep0
=
3650
;
createReq
.
daysToKeep1
=
3650
;
createReq
.
daysToKeep2
=
3650
;
...
...
@@ -66,6 +45,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
createReq
.
maxRows
=
4096
;
createReq
.
commitTime
=
3600
;
createReq
.
fsyncPeriod
=
3000
;
createReq
.
ttl
=
0
;
createReq
.
walLevel
=
1
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
...
...
@@ -74,6 +54,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
ignoreExist
=
1
;
createReq
.
streamMode
=
0
;
createReq
.
singleSTable
=
0
;
createReq
.
numOfRetensions
=
0
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
...
...
@@ -84,47 +67,11 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
17
);
test
.
SendShowRetrieveReq
();
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt32
(
0
);
// ntables
CheckInt16
(
1
);
// replica
CheckInt16
(
1
);
// quorum
CheckInt16
(
10
);
// days
CheckBinary
(
"3650,3650,3650"
,
24
);
// days
CheckInt32
(
16
);
// cache
CheckInt32
(
10
);
// blocks
CheckInt32
(
100
);
// minrows
CheckInt32
(
4096
);
// maxrows
CheckInt8
(
1
);
// wallevel
CheckInt32
(
3000
);
// fsync
CheckInt8
(
2
);
// comp
CheckInt8
(
0
);
// cachelast
CheckBinary
(
"ms"
,
3
);
// precision
CheckInt8
(
0
);
// update
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_VGROUP
,
"1.d1"
);
CHECK_META
(
"show vgroups"
,
4
);
CHECK_SCHEMA
(
0
,
TSDB_DATA_TYPE_INT
,
4
,
"vgId"
);
CHECK_SCHEMA
(
1
,
TSDB_DATA_TYPE_INT
,
4
,
"tables"
);
CHECK_SCHEMA
(
2
,
TSDB_DATA_TYPE_SMALLINT
,
2
,
"v1_dnode"
);
CHECK_SCHEMA
(
3
,
TSDB_DATA_TYPE_BINARY
,
9
+
VARSTR_HEADER_SIZE
,
"v1_status"
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"user_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_VGROUP
,
"vgroups"
,
"1.d1"
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
CheckInt32
(
2
);
CheckInt32
(
3
);
IgnoreInt32
();
IgnoreInt32
();
CheckInt16
(
1
);
CheckInt16
(
1
);
CheckBinary
(
"master"
,
9
);
CheckBinary
(
"master"
,
9
);
{
SAlterDbReq
alterdbReq
=
{
0
};
...
...
@@ -147,55 +94,14 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_DB
,
""
);
test
.
SendShowRetrieveReq
();
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt32
(
0
);
// tables
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
CheckBinary
(
"300,400,500"
,
24
);
// days
CheckInt32
(
16
);
// cache
CheckInt32
(
12
);
// blocks
CheckInt32
(
100
);
// minrows
CheckInt32
(
4096
);
// maxrows
CheckInt8
(
2
);
// wallevel
CheckInt32
(
4000
);
// fsync
CheckInt8
(
2
);
// comp
CheckInt8
(
1
);
// cachelast
CheckBinary
(
"ms"
,
3
);
// precision
CheckInt8
(
0
);
// update
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"user_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
// restart
test
.
Restart
();
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
17
);
test
.
SendShowRetrieveReq
();
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
CheckBinary
(
"d1"
,
TSDB_DB_NAME_LEN
-
1
);
CheckTimestamp
();
CheckInt16
(
2
);
// vgroups
CheckInt32
(
0
);
// tables
CheckInt16
(
1
);
// replica
CheckInt16
(
2
);
// quorum
CheckInt16
(
10
);
// days
CheckBinary
(
"300,400,500"
,
24
);
// days
CheckInt32
(
16
);
// cache
CheckInt32
(
12
);
// blocks
CheckInt32
(
100
);
// minrows
CheckInt32
(
4096
);
// maxrows
CheckInt8
(
2
);
// wallevel
CheckInt32
(
4000
);
// fsync
CheckInt8
(
2
);
// comp
CheckInt8
(
1
);
// cachelast
CheckBinary
(
"ms"
,
3
);
// precision
CheckInt8
(
0
);
// update
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"user_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
{
SDropDbReq
dropdbReq
=
{
0
};
...
...
@@ -214,11 +120,8 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
EXPECT_STREQ
(
dropdbRsp
.
db
,
"1.d1"
);
}
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
17
);
test
.
SendShowRetrieveReq
();
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"user_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
TEST_F
(
MndTestDb
,
03
_Create_Use_Restart_Use_Db
)
{
...
...
@@ -228,7 +131,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
createReq
.
numOfVgroups
=
2
;
createReq
.
cacheBlockSize
=
16
;
createReq
.
totalBlocks
=
10
;
createReq
.
daysPerFile
=
10
;
createReq
.
daysPerFile
=
10
00
;
createReq
.
daysToKeep0
=
3650
;
createReq
.
daysToKeep1
=
3650
;
createReq
.
daysToKeep2
=
3650
;
...
...
@@ -236,6 +139,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
createReq
.
maxRows
=
4096
;
createReq
.
commitTime
=
3600
;
createReq
.
fsyncPeriod
=
3000
;
createReq
.
ttl
=
0
;
createReq
.
walLevel
=
1
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
...
...
@@ -244,6 +148,9 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
ignoreExist
=
1
;
createReq
.
streamMode
=
0
;
createReq
.
singleSTable
=
0
;
createReq
.
numOfRetensions
=
0
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
...
...
@@ -254,12 +161,8 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_DB
,
""
);
CHECK_META
(
"show databases"
,
17
);
test
.
SendShowRetrieveReq
();
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
CheckBinary
(
"d2"
,
TSDB_DB_NAME_LEN
-
1
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_DB
,
"user_databases"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
uint64_t
d2_uid
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录