Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1e73923c
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看板
提交
1e73923c
编写于
4月 15, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: reopen userTest
上级
de121928
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
114 deletion
+17
-114
source/dnode/mnode/impl/test/user/CMakeLists.txt
source/dnode/mnode/impl/test/user/CMakeLists.txt
+5
-5
source/dnode/mnode/impl/test/user/user.cpp
source/dnode/mnode/impl/test/user/user.cpp
+12
-109
未找到文件。
source/dnode/mnode/impl/test/user/CMakeLists.txt
浏览文件 @
1e73923c
aux_source_directory
(
.
USER
_SRC
)
add_executable
(
mnode_test_user
${
USER
_SRC
}
)
aux_source_directory
(
.
MNODE_USER_TEST
_SRC
)
add_executable
(
userTest
${
MNODE_USER_TEST
_SRC
}
)
target_link_libraries
(
mnode_test_user
userTest
PUBLIC sut
)
add_test
(
NAME
mnode_test_user
COMMAND
mnode_test_user
NAME
userTest
COMMAND
userTest
)
source/dnode/mnode/impl/test/user/user.cpp
浏览文件 @
1e73923c
...
...
@@ -26,21 +26,8 @@ class MndTestUser : public ::testing::Test {
Testbase
MndTestUser
::
test
;
TEST_F
(
MndTestUser
,
01
_Show_User
)
{
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
CHECK_META
(
"show users"
,
4
);
CHECK_SCHEMA
(
0
,
TSDB_DATA_TYPE_BINARY
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
"name"
);
CHECK_SCHEMA
(
1
,
TSDB_DATA_TYPE_BINARY
,
10
+
VARSTR_HEADER_SIZE
,
"privilege"
);
CHECK_SCHEMA
(
2
,
TSDB_DATA_TYPE_TIMESTAMP
,
8
,
"create_time"
);
CHECK_SCHEMA
(
3
,
TSDB_DATA_TYPE_BINARY
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
"account"
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"super"
,
10
);
CheckTimestamp
();
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
TEST_F
(
MndTestUser
,
02
_Create_User
)
{
...
...
@@ -99,18 +86,8 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
CheckBinary
(
"u1"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"normal"
,
10
);
CheckBinary
(
"super"
,
10
);
CheckTimestamp
();
CheckTimestamp
();
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
{
...
...
@@ -125,8 +102,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -144,18 +120,8 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"u2"
,
TSDB_USER_LEN
);
CheckBinary
(
"super"
,
10
);
CheckBinary
(
"super"
,
10
);
CheckTimestamp
();
CheckTimestamp
();
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
{
...
...
@@ -170,8 +136,7 @@ TEST_F(MndTestUser, 02_Create_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
}
...
...
@@ -191,8 +156,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
}
...
...
@@ -437,8 +401,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
}
...
...
@@ -497,10 +460,7 @@ TEST_F(MndTestUser, 05_Drop_User) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
CHECK_META
(
"show users"
,
4
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
...
...
@@ -533,25 +493,9 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
CHECK_META
(
"show users"
,
4
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
CheckBinary
(
"u1"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"u2"
,
TSDB_USER_LEN
);
CheckBinary
(
"normal"
,
10
);
CheckBinary
(
"super"
,
10
);
CheckBinary
(
"normal"
,
10
);
CheckTimestamp
();
CheckTimestamp
();
CheckTimestamp
();
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
{
SAlterUserReq
alterReq
=
{
0
};
alterReq
.
alterType
=
TSDB_ALTER_USER_PASSWD
;
...
...
@@ -567,25 +511,8 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
CHECK_META
(
"show users"
,
4
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
3
);
CheckBinary
(
"u1"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"u2"
,
TSDB_USER_LEN
);
CheckBinary
(
"normal"
,
10
);
CheckBinary
(
"super"
,
10
);
CheckBinary
(
"normal"
,
10
);
CheckTimestamp
();
CheckTimestamp
();
CheckTimestamp
();
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
{
SDropUserReq
dropReq
=
{
0
};
strcpy
(
dropReq
.
user
,
"u1"
);
...
...
@@ -599,37 +526,13 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
CHECK_META
(
"show users"
,
4
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"u2"
,
TSDB_USER_LEN
);
CheckBinary
(
"super"
,
10
);
CheckBinary
(
"normal"
,
10
);
CheckTimestamp
();
CheckTimestamp
();
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
// restart
test
.
Restart
();
taosMsleep
(
1000
);
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_USER
,
""
);
CHECK_META
(
"show users"
,
4
);
test
.
SendShowRetrieveReq
();
test
.
SendShowReq
(
TSDB_MGMT_TABLE_USER
,
"user_users"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
2
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"u2"
,
TSDB_USER_LEN
);
CheckBinary
(
"super"
,
10
);
CheckBinary
(
"normal"
,
10
);
CheckTimestamp
();
CheckTimestamp
();
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
CheckBinary
(
"root"
,
TSDB_USER_LEN
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录