Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8d482158
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
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,发现更多精彩内容 >>
未验证
提交
8d482158
编写于
12月 05, 2021
作者:
S
Shengliang Guan
提交者:
GitHub
12月 05, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8931 from taosdata/feature/dnode3
[TD-10431]<feature> add test cases for dnode
上级
278fc0f6
1f600bb6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
42 addition
and
11 deletion
+42
-11
source/dnode/mgmt/impl/test/sut/deploy.cpp
source/dnode/mgmt/impl/test/sut/deploy.cpp
+2
-2
source/dnode/mgmt/impl/test/sut/deploy.h
source/dnode/mgmt/impl/test/sut/deploy.h
+0
-0
source/dnode/mgmt/impl/test/test01/CMakeLists.txt
source/dnode/mgmt/impl/test/test01/CMakeLists.txt
+3
-3
source/dnode/mgmt/impl/test/test01/test01.cpp
source/dnode/mgmt/impl/test/test01/test01.cpp
+5
-5
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+21
-1
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+1
-0
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+10
-0
未找到文件。
source/dnode/mgmt/impl/test/
util/dndTestD
eploy.cpp
→
source/dnode/mgmt/impl/test/
sut/d
eploy.cpp
浏览文件 @
8d482158
...
...
@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "d
ndTestD
eploy.h"
#include "deploy.h"
void
initLog
(
char
*
path
)
{
mDebugFlag
=
207
;
...
...
@@ -80,7 +80,7 @@ void dropServer(SServer* pServer) {
void
processClientRsp
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SClient
*
pClient
=
(
SClient
*
)
parent
;
pClient
->
pRsp
=
pMsg
;
taosMsleep
(
1
00000
);
//taosMsleep(10
00000);
tsem_post
(
&
pClient
->
sem
);
}
...
...
source/dnode/mgmt/impl/test/
util/dndTestD
eploy.h
→
source/dnode/mgmt/impl/test/
sut/d
eploy.h
浏览文件 @
8d482158
文件已移动
source/dnode/mgmt/impl/test/test01/CMakeLists.txt
浏览文件 @
8d482158
...
...
@@ -2,8 +2,8 @@ add_executable(dndTest01 "")
target_sources
(
dndTest01
PRIVATE
"
dndT
est01.cpp"
"../
util/dndTestD
eploy.cpp"
"
t
est01.cpp"
"../
sut/d
eploy.cpp"
)
target_link_libraries
(
...
...
@@ -18,7 +18,7 @@ target_include_directories(dndTest01
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/dnode/mgmt"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../
util
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../
sut
"
)
enable_testing
()
...
...
source/dnode/mgmt/impl/test/test01/
dndT
est01.cpp
→
source/dnode/mgmt/impl/test/test01/
t
est01.cpp
浏览文件 @
8d482158
...
...
@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "d
ndTestD
eploy.h"
#include "deploy.h"
class
DndTest01
:
public
::
testing
::
Test
{
protected:
...
...
@@ -43,16 +43,16 @@ TEST_F(DndTest01, connectMsg) {
sendMsg
(
pClient
,
&
rpcMsg
);
SConnectRsp
*
pRsp
=
(
SConnectRsp
*
)
pClient
->
pRsp
;
ASSERT
(
pRsp
);
SConnectRsp
*
pRsp
=
(
SConnectRsp
*
)
pClient
->
pRsp
->
pCont
;
ASSERT
_NE
(
pRsp
,
nullptr
);
pRsp
->
acctId
=
htonl
(
pRsp
->
acctId
);
pRsp
->
clusterId
=
htonl
(
pRsp
->
clusterId
);
pRsp
->
connId
=
htonl
(
pRsp
->
connId
);
pRsp
->
epSet
.
port
[
0
]
=
hton
l
(
pRsp
->
epSet
.
port
[
0
]);
pRsp
->
epSet
.
port
[
0
]
=
hton
s
(
pRsp
->
epSet
.
port
[
0
]);
EXPECT_EQ
(
pRsp
->
acctId
,
1
);
EXPECT_GT
(
pRsp
->
clusterId
,
0
);
EXPECT_
GT
(
pRsp
->
connId
,
1
);
EXPECT_
EQ
(
pRsp
->
connId
,
1
);
EXPECT_EQ
(
pRsp
->
superAuth
,
1
);
EXPECT_EQ
(
pRsp
->
readAuth
,
1
);
EXPECT_EQ
(
pRsp
->
writeAuth
,
1
);
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
8d482158
...
...
@@ -137,4 +137,24 @@ bool mndIsMnode(SMnode *pMnode, int32_t dnodeId) {
return
true
;
}
void
mndGetMnodeEpSet
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
)
{}
\ No newline at end of file
void
mndGetMnodeEpSet
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
pEpSet
->
numOfEps
=
0
;
void
*
pIter
=
NULL
;
while
(
1
)
{
SMnodeObj
*
pMnodeObj
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_MNODE
,
pIter
,
(
void
**
)
&
pMnodeObj
);
if
(
pIter
==
NULL
)
break
;
if
(
pMnodeObj
->
pDnode
==
NULL
)
break
;
pEpSet
->
port
[
pEpSet
->
numOfEps
]
=
htons
(
pMnodeObj
->
pDnode
->
port
);
tstrncpy
(
pEpSet
->
fqdn
[
pEpSet
->
numOfEps
],
pMnodeObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
if
(
pMnodeObj
->
role
==
TAOS_SYNC_STATE_LEADER
)
{
pEpSet
->
inUse
=
pEpSet
->
numOfEps
;
}
pEpSet
->
numOfEps
++
;
}
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
8d482158
...
...
@@ -130,6 +130,7 @@ static SConnObj *mndCreateConn(SMnode *pMnode, char *user, uint32_t ip, uint16_t
static
void
mndFreeConn
(
SConnObj
*
pConn
)
{
tfree
(
pConn
->
pQueries
);
tfree
(
pConn
->
pStreams
);
tfree
(
pConn
);
mDebug
(
"conn:%d, is destroyed"
,
pConn
->
connId
);
}
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
8d482158
...
...
@@ -59,6 +59,8 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
taosEncryptPass
((
uint8_t
*
)
pass
,
strlen
(
pass
),
userObj
.
pass
);
userObj
.
createdTime
=
taosGetTimestampMs
();
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
readAuth
=
1
;
userObj
.
writeAuth
=
1
;
if
(
strcmp
(
user
,
TSDB_DEFAULT_USER
)
==
0
)
{
userObj
.
superAuth
=
1
;
...
...
@@ -95,6 +97,8 @@ static SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
createdTime
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
updateTime
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
superAuth
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
readAuth
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
writeAuth
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
);
return
pRaw
;
...
...
@@ -121,6 +125,8 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
createdTime
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
updateTime
)
SDB_GET_INT8
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
superAuth
)
SDB_GET_INT8
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
readAuth
)
SDB_GET_INT8
(
pRaw
,
pRow
,
dataPos
,
&
pUser
->
writeAuth
)
return
pRow
;
}
...
...
@@ -164,6 +170,8 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pSrcUser, SUserObj *pDs
pSrcUser
->
createdTime
=
pDstUser
->
createdTime
;
pSrcUser
->
updateTime
=
pDstUser
->
updateTime
;
pSrcUser
->
superAuth
=
pDstUser
->
superAuth
;
pSrcUser
->
readAuth
=
pDstUser
->
readAuth
;
pSrcUser
->
writeAuth
=
pDstUser
->
writeAuth
;
return
0
;
}
...
...
@@ -185,6 +193,8 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, char *user, char *pass,
userObj
.
createdTime
=
taosGetTimestampMs
();
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
superAuth
=
0
;
userObj
.
readAuth
=
1
;
userObj
.
writeAuth
=
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
pMsg
->
rpcMsg
.
handle
);
if
(
pTrans
==
NULL
)
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录