Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c57e5d49
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看板
提交
c57e5d49
编写于
12月 06, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 acct test
上级
88fbe656
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
151 addition
and
14 deletion
+151
-14
include/common/taosmsg.h
include/common/taosmsg.h
+8
-13
source/dnode/mgmt/impl/test/CMakeLists.txt
source/dnode/mgmt/impl/test/CMakeLists.txt
+2
-1
source/dnode/mgmt/impl/test/acct/CMakeLists.txt
source/dnode/mgmt/impl/test/acct/CMakeLists.txt
+29
-0
source/dnode/mgmt/impl/test/acct/acct.cpp
source/dnode/mgmt/impl/test/acct/acct.cpp
+112
-0
未找到文件。
include/common/taosmsg.h
浏览文件 @
c57e5d49
...
@@ -360,10 +360,10 @@ typedef struct {
...
@@ -360,10 +360,10 @@ typedef struct {
}
SConnectMsg
;
}
SConnectMsg
;
typedef
struct
SEpSet
{
typedef
struct
SEpSet
{
int8_t
inUse
;
int8_t
inUse
;
int8_t
numOfEps
;
int8_t
numOfEps
;
uint16_t
port
[
TSDB_MAX_REPLICA
];
uint16_t
port
[
TSDB_MAX_REPLICA
];
char
fqdn
[
TSDB_MAX_REPLICA
][
TSDB_FQDN_LEN
];
char
fqdn
[
TSDB_MAX_REPLICA
][
TSDB_FQDN_LEN
];
}
SEpSet
;
}
SEpSet
;
typedef
struct
{
typedef
struct
{
...
@@ -383,14 +383,9 @@ typedef struct {
...
@@ -383,14 +383,9 @@ typedef struct {
int32_t
maxUsers
;
int32_t
maxUsers
;
int32_t
maxDbs
;
int32_t
maxDbs
;
int32_t
maxTimeSeries
;
int32_t
maxTimeSeries
;
int32_t
maxConnections
;
int32_t
maxStreams
;
int32_t
maxStreams
;
int32_t
maxPointsPerSecond
;
int64_t
maxStorage
;
// In unit of GB
int64_t
maxStorage
;
// In unit of GB
int32_t
accessState
;
// Configured only by command
int64_t
maxQueryTime
;
// In unit of hour
int64_t
maxInbound
;
int64_t
maxOutbound
;
int8_t
accessState
;
// Configured only by command
}
SCreateAcctMsg
,
SAlterAcctMsg
;
}
SCreateAcctMsg
,
SAlterAcctMsg
;
typedef
struct
{
typedef
struct
{
...
@@ -398,8 +393,8 @@ typedef struct {
...
@@ -398,8 +393,8 @@ typedef struct {
}
SDropUserMsg
,
SDropAcctMsg
;
}
SDropUserMsg
,
SDropAcctMsg
;
typedef
struct
{
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
];
char
pass
[
TSDB_KEY_LEN
];
}
SCreateUserMsg
,
SAlterUserMsg
;
}
SCreateUserMsg
,
SAlterUserMsg
;
typedef
struct
{
typedef
struct
{
...
...
source/dnode/mgmt/impl/test/CMakeLists.txt
浏览文件 @
c57e5d49
add_subdirectory
(
acct
)
add_subdirectory
(
profile
)
add_subdirectory
(
profile
)
add_subdirectory
(
show
)
add_subdirectory
(
show
)
\ No newline at end of file
source/dnode/mgmt/impl/test/acct/CMakeLists.txt
0 → 100644
浏览文件 @
c57e5d49
add_executable
(
dndTestAcct
""
)
target_sources
(
dndTestAcct
PRIVATE
"acct.cpp"
"../sut/deploy.cpp"
)
target_link_libraries
(
dndTestAcct
PUBLIC dnode
PUBLIC util
PUBLIC os
PUBLIC gtest_main
)
target_include_directories
(
dndTestAcct
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/dnode/mgmt"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../sut"
)
enable_testing
()
add_test
(
NAME dndTestAcct
COMMAND dndTestAcct
)
source/dnode/mgmt/impl/test/acct/acct.cpp
0 → 100644
浏览文件 @
c57e5d49
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deploy.h"
class
DndTestAcct
:
public
::
testing
::
Test
{
protected:
void
SetUp
()
override
{}
void
TearDown
()
override
{}
static
void
SetUpTestSuite
()
{
const
char
*
user
=
"root"
;
const
char
*
pass
=
"taosdata"
;
const
char
*
path
=
"/tmp/dndTestAcct"
;
const
char
*
fqdn
=
"localhost"
;
uint16_t
port
=
9520
;
pServer
=
createServer
(
path
,
fqdn
,
port
);
ASSERT
(
pServer
);
pClient
=
createClient
(
user
,
pass
,
fqdn
,
port
);
}
static
void
TearDownTestSuite
()
{
dropServer
(
pServer
);
dropClient
(
pClient
);
}
static
SServer
*
pServer
;
static
SClient
*
pClient
;
static
int32_t
connId
;
};
SServer
*
DndTestAcct
::
pServer
;
SClient
*
DndTestAcct
::
pClient
;
int32_t
DndTestAcct
::
connId
;
TEST_F
(
DndTestAcct
,
CreateAcct
)
{
ASSERT_NE
(
pClient
,
nullptr
);
SCreateAcctMsg
*
pReq
=
(
SCreateAcctMsg
*
)
rpcMallocCont
(
sizeof
(
SCreateAcctMsg
));
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SCreateAcctMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CREATE_ACCT
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_MSG_NOT_PROCESSED
);
}
TEST_F
(
DndTestAcct
,
AlterAcct
)
{
ASSERT_NE
(
pClient
,
nullptr
);
SAlterAcctMsg
*
pReq
=
(
SAlterAcctMsg
*
)
rpcMallocCont
(
sizeof
(
SAlterAcctMsg
));
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SAlterAcctMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_ALTER_ACCT
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_MSG_NOT_PROCESSED
);
}
TEST_F
(
DndTestAcct
,
DropAcct
)
{
ASSERT_NE
(
pClient
,
nullptr
);
SDropAcctMsg
*
pReq
=
(
SDropAcctMsg
*
)
rpcMallocCont
(
sizeof
(
SDropAcctMsg
));
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SDropAcctMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DROP_ACCT
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_MSG_NOT_PROCESSED
);
}
TEST_F
(
DndTestAcct
,
ShowAcct
)
{
ASSERT_NE
(
pClient
,
nullptr
);
SShowMsg
*
pReq
=
(
SShowMsg
*
)
rpcMallocCont
(
sizeof
(
SShowMsg
));
pReq
->
type
=
TSDB_MGMT_TABLE_ACCT
;
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SShowMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_SHOW
;
sendMsg
(
pClient
,
&
rpcMsg
);
SRpcMsg
*
pMsg
=
pClient
->
pRsp
;
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
TSDB_CODE_MND_INVALID_MSG_TYPE
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录