Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ff86bc29
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看板
提交
ff86bc29
编写于
12月 05, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 rename test file
上级
1f600bb6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
73 addition
and
54 deletion
+73
-54
source/dnode/mgmt/impl/test/CMakeLists.txt
source/dnode/mgmt/impl/test/CMakeLists.txt
+1
-1
source/dnode/mgmt/impl/test/profile/CMakeLists.txt
source/dnode/mgmt/impl/test/profile/CMakeLists.txt
+7
-7
source/dnode/mgmt/impl/test/profile/profile.cpp
source/dnode/mgmt/impl/test/profile/profile.cpp
+56
-37
source/dnode/mgmt/impl/test/sut/deploy.cpp
source/dnode/mgmt/impl/test/sut/deploy.cpp
+8
-8
source/dnode/mgmt/impl/test/sut/deploy.h
source/dnode/mgmt/impl/test/sut/deploy.h
+1
-1
未找到文件。
source/dnode/mgmt/impl/test/CMakeLists.txt
浏览文件 @
ff86bc29
add_subdirectory
(
test01
)
\ No newline at end of file
add_subdirectory
(
profile
)
\ No newline at end of file
source/dnode/mgmt/impl/test/
test01
/CMakeLists.txt
→
source/dnode/mgmt/impl/test/
profile
/CMakeLists.txt
浏览文件 @
ff86bc29
add_executable
(
dndTest
01
""
)
add_executable
(
dndTest
Profile
""
)
target_sources
(
dndTest
01
target_sources
(
dndTest
Profile
PRIVATE
"
test01
.cpp"
"
profile
.cpp"
"../sut/deploy.cpp"
)
target_link_libraries
(
dndTest
01
dndTest
Profile
PUBLIC dnode
PUBLIC util
PUBLIC os
PUBLIC gtest_main
)
target_include_directories
(
dndTest
01
target_include_directories
(
dndTest
Profile
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/server/dnode/mgmt"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
...
...
@@ -24,6 +24,6 @@ target_include_directories(dndTest01
enable_testing
()
add_test
(
NAME dndTest
01
COMMAND dndTest
01
NAME dndTest
Profile
COMMAND dndTest
Profile
)
source/dnode/mgmt/impl/test/
test01/test01
.cpp
→
source/dnode/mgmt/impl/test/
profile/profile
.cpp
浏览文件 @
ff86bc29
...
...
@@ -15,22 +15,32 @@
#include "deploy.h"
class
DndTest
01
:
public
::
testing
::
Test
{
class
DndTest
Profile
:
public
::
testing
::
Test
{
protected:
void
SetUp
()
override
{
pServer
=
createServer
(
"/tmp/dndTest01"
);
void
SetUp
()
override
{}
void
TearDown
()
override
{}
static
void
SetUpTestSuite
()
{
pServer
=
createServer
(
"/tmp/dndTestProfile"
,
"localhost"
,
9527
);
pClient
=
createClient
(
"root"
,
"taosdata"
);
}
void
TearDown
()
override
{
static
void
TearDownTestSuite
()
{
dropServer
(
pServer
);
dropClient
(
pClient
);
}
SServer
*
pServer
;
SClient
*
pClient
;
static
SServer
*
pServer
;
static
SClient
*
pClient
;
};
TEST_F
(
DndTest01
,
connectMsg
)
{
SServer
*
DndTestProfile
::
pServer
;
SClient
*
DndTestProfile
::
pClient
;
TEST_F
(
DndTestProfile
,
connectMsg_01
)
{
ASSERT_NE
(
pServer
,
nullptr
);
ASSERT_NE
(
pClient
,
nullptr
);
SConnectMsg
*
pReq
=
(
SConnectMsg
*
)
rpcMallocCont
(
sizeof
(
SConnectMsg
));
pReq
->
pid
=
htonl
(
1234
);
strcpy
(
pReq
->
app
,
"test01"
);
...
...
@@ -63,33 +73,42 @@ TEST_F(DndTest01, connectMsg) {
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
}
// TEST_F(DndTest01, heartbeatMsg) {
// SHeartBeatMsg* pReq = (SHeartBeatMsg*)rpcMallocCont(sizeof(SHeartBeatMsg));
// pReq->connId = htonl(1);
// pReq->pid = htonl(1234);
// pReq->numOfQueries = htonl(0);
// pReq->numOfStreams = htonl(0);
// strcpy(pReq->app, "test01");
// SRpcMsg rpcMsg = {0};
// rpcMsg.pCont = pReq;
// rpcMsg.contLen = sizeof(SHeartBeatMsg);
// rpcMsg.msgType = TSDB_MSG_TYPE_HEARTBEAT;
// sendMsg(pClient, &rpcMsg);
// SHeartBeatRsp* pRsp = (SHeartBeatRsp*)pClient->pRsp;
// ASSERT(pRsp);
// pRsp->epSet.port[0] = htonl(pRsp->epSet.port[0]);
// EXPECT_EQ(htonl(pRsp->connId), 1);
// EXPECT_GT(htonl(pRsp->queryId), 0);
// EXPECT_GT(htonl(pRsp->streamId), 1);
// EXPECT_EQ(htonl(pRsp->totalDnodes), 1);
// EXPECT_EQ(htonl(pRsp->onlineDnodes), 1);
// EXPECT_EQ(pRsp->killConnection, 0);
// EXPECT_EQ(pRsp->epSet.inUse, 0);
// EXPECT_EQ(pRsp->epSet.numOfEps, 1);
// EXPECT_EQ(pRsp->epSet.port[0], 9527);
// EXPECT_STREQ(pRsp->epSet.fqdn[0], "localhost");
// }
TEST_F
(
DndTestProfile
,
heartbeatMsg_01
)
{
ASSERT_NE
(
pServer
,
nullptr
);
ASSERT_NE
(
pClient
,
nullptr
);
SHeartBeatMsg
*
pReq
=
(
SHeartBeatMsg
*
)
rpcMallocCont
(
sizeof
(
SHeartBeatMsg
));
pReq
->
connId
=
htonl
(
1
);
pReq
->
pid
=
htonl
(
1234
);
pReq
->
numOfQueries
=
htonl
(
0
);
pReq
->
numOfStreams
=
htonl
(
0
);
strcpy
(
pReq
->
app
,
"test01"
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pReq
;
rpcMsg
.
contLen
=
sizeof
(
SHeartBeatMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_HEARTBEAT
;
sendMsg
(
pClient
,
&
rpcMsg
);
SHeartBeatRsp
*
pRsp
=
(
SHeartBeatRsp
*
)
pClient
->
pRsp
->
pCont
;
ASSERT_NE
(
pRsp
,
nullptr
);
pRsp
->
connId
=
htonl
(
pRsp
->
connId
);
pRsp
->
queryId
=
htonl
(
pRsp
->
queryId
);
pRsp
->
streamId
=
htonl
(
pRsp
->
streamId
);
pRsp
->
totalDnodes
=
htonl
(
pRsp
->
totalDnodes
);
pRsp
->
onlineDnodes
=
htonl
(
pRsp
->
onlineDnodes
);
pRsp
->
epSet
.
port
[
0
]
=
htons
(
pRsp
->
epSet
.
port
[
0
]);
EXPECT_EQ
(
pRsp
->
connId
,
1
);
EXPECT_EQ
(
pRsp
->
queryId
,
0
);
EXPECT_EQ
(
pRsp
->
streamId
,
0
);
EXPECT_EQ
(
pRsp
->
totalDnodes
,
1
);
EXPECT_EQ
(
pRsp
->
onlineDnodes
,
1
);
EXPECT_EQ
(
pRsp
->
killConnection
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
9527
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
}
source/dnode/mgmt/impl/test/sut/deploy.cpp
浏览文件 @
ff86bc29
...
...
@@ -15,7 +15,7 @@
#include "deploy.h"
void
initLog
(
char
*
path
)
{
void
initLog
(
char
*
path
)
{
mDebugFlag
=
207
;
char
temp
[
PATH_MAX
];
snprintf
(
temp
,
PATH_MAX
,
"%s/taosdlog"
,
path
);
...
...
@@ -32,7 +32,7 @@ void* runServer(void* param) {
}
}
void
initOption
(
SDnodeOpt
*
pOption
,
char
*
path
)
{
void
initOption
(
SDnodeOpt
*
pOption
,
char
*
path
,
char
*
fqdn
,
uint16_t
port
)
{
pOption
->
sver
=
1
;
pOption
->
numOfCores
=
1
;
pOption
->
numOfSupportMnodes
=
1
;
...
...
@@ -44,19 +44,19 @@ void initOption(SDnodeOpt* pOption, char *path) {
pOption
->
ratioOfQueryCores
=
1
;
pOption
->
maxShellConns
=
1000
;
pOption
->
shellActivityTimer
=
30
;
pOption
->
serverPort
=
9527
;
pOption
->
serverPort
=
port
;
strcpy
(
pOption
->
dataDir
,
path
);
s
trcpy
(
pOption
->
localEp
,
"localhost:9527"
);
s
trcpy
(
pOption
->
localFqdn
,
"localhost"
);
s
trcpy
(
pOption
->
firstEp
,
"localhost:9527"
);
s
nprintf
(
pOption
->
localEp
,
TSDB_EP_LEN
,
"%s:&u"
,
fqdn
,
port
);
s
nprintf
(
pOption
->
localFqdn
,
TSDB_FQDN_LEN
,
"%s"
,
fqdn
);
s
nprintf
(
pOption
->
firstEp
,
TSDB_EP_LEN
,
"%s:&u"
,
fqdn
,
port
);
taosRemoveDir
(
path
);
taosMkDir
(
path
);
}
SServer
*
createServer
(
char
*
path
)
{
SServer
*
createServer
(
char
*
path
,
char
*
fqdn
,
uint16_t
port
)
{
SDnodeOpt
option
=
{
0
};
initOption
(
&
option
,
path
);
initOption
(
&
option
,
path
,
fqdn
,
port
);
SDnode
*
pDnode
=
dndInit
(
&
option
);
ASSERT
(
pDnode
);
...
...
source/dnode/mgmt/impl/test/sut/deploy.h
浏览文件 @
ff86bc29
...
...
@@ -36,7 +36,7 @@ typedef struct {
tsem_t
sem
;
}
SClient
;
SServer
*
createServer
(
char
*
path
);
SServer
*
createServer
(
char
*
path
,
char
*
fqdn
,
uint16_t
port
);
void
dropServer
(
SServer
*
pServer
);
SClient
*
createClient
(
char
*
user
,
char
*
pass
);
void
dropClient
(
SClient
*
pClient
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录