Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9a9a1927
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9a9a1927
编写于
5月 17, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: make more object global
上级
b16a21b2
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
129 addition
and
159 deletion
+129
-159
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
+2
-0
source/dnode/mgmt/node_mgmt/src/dmEnv.c
source/dnode/mgmt/node_mgmt/src/dmEnv.c
+2
-0
source/dnode/mgmt/test/CMakeLists.txt
source/dnode/mgmt/test/CMakeLists.txt
+1
-1
source/dnode/mgmt/test/bnode/dbnode.cpp
source/dnode/mgmt/test/bnode/dbnode.cpp
+4
-6
source/dnode/mgmt/test/mnode/dmnode.cpp
source/dnode/mgmt/test/mnode/dmnode.cpp
+1
-1
source/dnode/mgmt/test/qnode/dqnode.cpp
source/dnode/mgmt/test/qnode/dqnode.cpp
+1
-1
source/dnode/mgmt/test/snode/dsnode.cpp
source/dnode/mgmt/test/snode/dsnode.cpp
+1
-1
source/dnode/mgmt/test/sut/inc/client.h
source/dnode/mgmt/test/sut/inc/client.h
+1
-4
source/dnode/mgmt/test/sut/inc/server.h
source/dnode/mgmt/test/sut/inc/server.h
+1
-10
source/dnode/mgmt/test/sut/src/client.cpp
source/dnode/mgmt/test/sut/src/client.cpp
+3
-4
source/dnode/mgmt/test/sut/src/server.cpp
source/dnode/mgmt/test/sut/src/server.cpp
+3
-33
source/dnode/mgmt/test/sut/src/sut.cpp
source/dnode/mgmt/test/sut/src/sut.cpp
+12
-11
source/dnode/mgmt/test/vnode/vnode.cpp
source/dnode/mgmt/test/vnode/vnode.cpp
+1
-1
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+1
-0
source/dnode/mnode/impl/test/acct/acct.cpp
source/dnode/mnode/impl/test/acct/acct.cpp
+1
-1
source/dnode/mnode/impl/test/bnode/CMakeLists.txt
source/dnode/mnode/impl/test/bnode/CMakeLists.txt
+10
-10
source/dnode/mnode/impl/test/bnode/mbnode.cpp
source/dnode/mnode/impl/test/bnode/mbnode.cpp
+1
-1
source/dnode/mnode/impl/test/dnode/CMakeLists.txt
source/dnode/mnode/impl/test/dnode/CMakeLists.txt
+10
-10
source/dnode/mnode/impl/test/dnode/mdnode.cpp
source/dnode/mnode/impl/test/dnode/mdnode.cpp
+5
-5
source/dnode/mnode/impl/test/mnode/CMakeLists.txt
source/dnode/mnode/impl/test/mnode/CMakeLists.txt
+10
-10
source/dnode/mnode/impl/test/mnode/mnode.cpp
source/dnode/mnode/impl/test/mnode/mnode.cpp
+3
-3
source/dnode/mnode/impl/test/qnode/CMakeLists.txt
source/dnode/mnode/impl/test/qnode/CMakeLists.txt
+10
-10
source/dnode/mnode/impl/test/qnode/qnode.cpp
source/dnode/mnode/impl/test/qnode/qnode.cpp
+3
-3
source/dnode/mnode/impl/test/snode/CMakeLists.txt
source/dnode/mnode/impl/test/snode/CMakeLists.txt
+10
-10
source/dnode/mnode/impl/test/snode/snode.cpp
source/dnode/mnode/impl/test/snode/snode.cpp
+3
-3
source/dnode/mnode/impl/test/trans/CMakeLists.txt
source/dnode/mnode/impl/test/trans/CMakeLists.txt
+18
-18
source/dnode/mnode/impl/test/trans/trans1.cpp
source/dnode/mnode/impl/test/trans/trans1.cpp
+2
-2
source/dnode/mnode/impl/test/trans/trans2.cpp
source/dnode/mnode/impl/test/trans/trans2.cpp
+9
-0
未找到文件。
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
浏览文件 @
9a9a1927
...
...
@@ -141,6 +141,8 @@ void dmProcessNetTestReq(SDnode *pDnode, SRpcMsg *pMsg);
// dmNodes.c
int32_t
dmOpenNode
(
SMgmtWrapper
*
pWrapper
);
int32_t
dmStartNode
(
SMgmtWrapper
*
pWrapper
);
void
dmStopNode
(
SMgmtWrapper
*
pWrapper
);
void
dmCloseNode
(
SMgmtWrapper
*
pWrapper
);
int32_t
dmRunDnode
(
SDnode
*
pDnode
);
...
...
source/dnode/mgmt/node_mgmt/src/dmEnv.c
浏览文件 @
9a9a1927
...
...
@@ -124,6 +124,7 @@ static int32_t dmProcessCreateNodeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
}
else
{
dInfo
(
"node:%s, has been created"
,
pWrapper
->
name
);
(
void
)
dmOpenNode
(
pWrapper
);
(
void
)
dmStartNode
(
pWrapper
);
pWrapper
->
required
=
true
;
pWrapper
->
deployed
=
true
;
pWrapper
->
proc
.
ptype
=
pDnode
->
ptype
;
...
...
@@ -159,6 +160,7 @@ static int32_t dmProcessDropNodeReq(EDndNodeType ntype, SRpcMsg *pMsg) {
dmReleaseWrapper
(
pWrapper
);
if
(
code
==
0
)
{
dmStopNode
(
pWrapper
);
dmCloseNode
(
pWrapper
);
taosRemoveDir
(
pWrapper
->
path
);
}
...
...
source/dnode/mgmt/test/CMakeLists.txt
浏览文件 @
9a9a1927
...
...
@@ -3,7 +3,7 @@ if(${BUILD_TEST})
add_subdirectory
(
qnode
)
add_subdirectory
(
bnode
)
add_subdirectory
(
snode
)
#
add_subdirectory(mnode)
add_subdirectory
(
mnode
)
add_subdirectory
(
vnode
)
add_subdirectory
(
sut
)
endif
(
${
BUILD_TEST
}
)
source/dnode/mgmt/test/bnode/dbnode.cpp
浏览文件 @
9a9a1927
...
...
@@ -14,11 +14,10 @@
class
DndTestBnode
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/d
node_test_bnode
"
,
9112
);
test
.
Init
(
"/tmp/d
bnodeTest
"
,
9112
);
taosMsleep
(
1100
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
public:
...
...
@@ -68,7 +67,7 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_ALREADY_DEPLOYED
);
}
test
.
Restart
();
//
test.Restart();
{
SDCreateBnodeReq
createReq
=
{
0
};
...
...
@@ -84,7 +83,6 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
}
TEST_F
(
DndTestBnode
,
02
_Drop_Bnode
)
{
#if 0
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
...
...
@@ -97,7 +95,7 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
#endif
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
...
...
@@ -124,7 +122,7 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_NOT_DEPLOYED
);
}
test
.
Restart
();
//
test.Restart();
{
SDDropBnodeReq
dropReq
=
{
0
};
...
...
source/dnode/mgmt/test/mnode/dmnode.cpp
浏览文件 @
9a9a1927
...
...
@@ -13,7 +13,7 @@
class
DndTestMnode
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/d
node_test_mnode
"
,
9114
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/d
mnodeTest
"
,
9114
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
source/dnode/mgmt/test/qnode/dqnode.cpp
浏览文件 @
9a9a1927
...
...
@@ -13,7 +13,7 @@
class
DndTestQnode
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/d
node_test_qnode
"
,
9111
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/d
qnodeTest
"
,
9111
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
source/dnode/mgmt/test/snode/dsnode.cpp
浏览文件 @
9a9a1927
...
...
@@ -13,7 +13,7 @@
class
DndTestSnode
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/d
node_test_snode
"
,
9113
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/d
snodeTest
"
,
9113
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
source/dnode/mgmt/test/sut/inc/client.h
浏览文件 @
9a9a1927
...
...
@@ -18,9 +18,8 @@
class
TestClient
{
public:
bool
Init
(
const
char
*
user
,
const
char
*
pass
,
const
char
*
fqdn
,
uint16_t
port
);
bool
Init
(
const
char
*
user
,
const
char
*
pass
);
void
Cleanup
();
void
DoInit
();
SRpcMsg
*
SendReq
(
SRpcMsg
*
pReq
);
...
...
@@ -29,8 +28,6 @@ class TestClient {
void
Restart
();
private:
char
fqdn
[
TSDB_FQDN_LEN
];
uint16_t
port
;
char
user
[
128
];
char
pass
[
128
];
void
*
clientRpc
;
...
...
source/dnode/mgmt/test/sut/inc/server.h
浏览文件 @
9a9a1927
...
...
@@ -18,20 +18,11 @@
class
TestServer
{
public:
bool
Start
(
const
char
*
path
,
const
char
*
fqdn
,
uint16_t
port
,
const
char
*
firstEp
);
bool
Start
();
void
Stop
();
void
Restart
();
bool
DoStart
();
private:
void
BuildOption
(
const
char
*
path
,
const
char
*
fqdn
,
uint16_t
port
,
const
char
*
firstEp
);
private:
TdThread
threadId
;
char
path
[
PATH_MAX
];
char
fqdn
[
TSDB_FQDN_LEN
];
char
firstEp
[
TSDB_EP_LEN
];
uint16_t
port
;
};
#endif
/* _TD_TEST_SERVER_H_ */
\ No newline at end of file
source/dnode/mgmt/test/sut/src/client.cpp
浏览文件 @
9a9a1927
...
...
@@ -58,11 +58,9 @@ void TestClient::DoInit() {
tsem_init
(
&
this
->
sem
,
0
,
0
);
}
bool
TestClient
::
Init
(
const
char
*
user
,
const
char
*
pass
,
const
char
*
fqdn
,
uint16_t
port
)
{
strcpy
(
this
->
fqdn
,
fqdn
);
bool
TestClient
::
Init
(
const
char
*
user
,
const
char
*
pass
)
{
strcpy
(
this
->
user
,
user
);
strcpy
(
this
->
pass
,
pass
);
this
->
port
=
port
;
this
->
pRsp
=
NULL
;
this
->
DoInit
();
return
true
;
...
...
@@ -77,9 +75,10 @@ void TestClient::Restart() {
this
->
Cleanup
();
this
->
DoInit
();
}
SRpcMsg
*
TestClient
::
SendReq
(
SRpcMsg
*
pReq
)
{
SEpSet
epSet
=
{
0
};
addEpIntoEpSet
(
&
epSet
,
fqdn
,
p
ort
);
addEpIntoEpSet
(
&
epSet
,
tsLocalFqdn
,
tsServerP
ort
);
rpcSendRequest
(
clientRpc
,
&
epSet
,
pReq
,
NULL
);
tsem_wait
(
&
sem
);
uInfo
(
"y response:%s from dnode, code:0x%x, msgSize: %d"
,
TMSG_INFO
(
pRsp
->
msgType
),
pRsp
->
code
,
pRsp
->
contLen
);
...
...
source/dnode/mgmt/test/sut/src/server.cpp
浏览文件 @
9a9a1927
...
...
@@ -16,25 +16,13 @@
#include "sut.h"
void
*
serverLoop
(
void
*
param
)
{
dmInit
(
0
);
dmRun
();
dmCleanup
();
return
NULL
;
}
void
TestServer
::
BuildOption
(
const
char
*
path
,
const
char
*
fqdn
,
uint16_t
port
,
const
char
*
firstEp
)
{
tsNumOfSupportVnodes
=
16
;
tsServerPort
=
port
;
strcpy
(
tsDataDir
,
path
);
snprintf
(
tsLocalEp
,
TSDB_EP_LEN
,
"%s:%u"
,
fqdn
,
port
);
snprintf
(
tsLocalFqdn
,
TSDB_FQDN_LEN
,
"%s"
,
fqdn
);
snprintf
(
tsFirst
,
TSDB_EP_LEN
,
"%s"
,
firstEp
);
taosMkDir
(
path
);
}
bool
TestServer
::
DoStart
()
{
if
(
dmInit
(
0
)
!=
0
)
{
return
false
;
}
bool
TestServer
::
Start
()
{
TdThreadAttr
thAttr
;
taosThreadAttrInit
(
&
thAttr
);
taosThreadAttrSetDetachState
(
&
thAttr
,
PTHREAD_CREATE_JOINABLE
);
...
...
@@ -44,25 +32,7 @@ bool TestServer::DoStart() {
return
true
;
}
void
TestServer
::
Restart
()
{
uInfo
(
"start all server"
);
Stop
();
DoStart
();
uInfo
(
"all server is running"
);
}
bool
TestServer
::
Start
(
const
char
*
path
,
const
char
*
fqdn
,
uint16_t
port
,
const
char
*
firstEp
)
{
strcpy
(
this
->
path
,
path
);
strcpy
(
this
->
fqdn
,
fqdn
);
this
->
port
=
port
;
strcpy
(
this
->
firstEp
,
firstEp
);
taosRemoveDir
(
path
);
return
DoStart
();
}
void
TestServer
::
Stop
()
{
dmStop
();
taosThreadJoin
(
threadId
,
NULL
);
dmCleanup
();
}
source/dnode/mgmt/test/sut/src/sut.cpp
浏览文件 @
9a9a1927
...
...
@@ -40,15 +40,17 @@ void Testbase::InitLog(const char* path) {
}
void
Testbase
::
Init
(
const
char
*
path
,
int16_t
port
)
{
dmInit
(
0
);
char
fqdn
[]
=
"localhost"
;
char
firstEp
[
TSDB_EP_LEN
]
=
{
0
};
snprintf
(
firstEp
,
TSDB_EP_LEN
,
"%s:%u"
,
fqdn
,
port
);
tsServerPort
=
port
;
strcpy
(
tsLocalFqdn
,
"localhost"
);
snprintf
(
tsLocalEp
,
TSDB_EP_LEN
,
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
strcpy
(
tsFirst
,
tsLocalEp
);
strcpy
(
tsDataDir
,
path
);
taosRemoveDir
(
path
);
taosMkDir
(
path
);
InitLog
(
"/tmp/td"
);
server
.
Start
(
path
,
fqdn
,
port
,
firstEp
);
client
.
Init
(
"root"
,
"taosdata"
,
fqdn
,
port
);
server
.
Start
();
client
.
Init
(
"root"
,
"taosdata"
);
showRsp
=
NULL
;
}
...
...
@@ -64,13 +66,12 @@ void Testbase::Cleanup() {
}
void
Testbase
::
Restart
()
{
server
.
Restart
();
//
server.Restart();
client
.
Restart
();
}
void
Testbase
::
ServerStop
()
{
server
.
Stop
();
}
void
Testbase
::
ServerStart
()
{
server
.
DoStart
();
}
void
Testbase
::
ServerStart
()
{
server
.
Start
();
}
void
Testbase
::
ClientRestart
()
{
client
.
Restart
();
}
SRpcMsg
*
Testbase
::
SendReq
(
tmsg_t
msgType
,
void
*
pCont
,
int32_t
contLen
)
{
...
...
source/dnode/mgmt/test/vnode/vnode.cpp
浏览文件 @
9a9a1927
...
...
@@ -13,7 +13,7 @@
class
DndTestVnode
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/d
node_test_vnode
"
,
9115
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/d
vnodeTest
"
,
9115
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
9a9a1927
...
...
@@ -122,6 +122,7 @@ static void mndCleanupTimer(SMnode *pMnode) {
pMnode
->
stopped
=
true
;
if
(
taosCheckPthreadValid
(
pMnode
->
thread
))
{
taosThreadJoin
(
pMnode
->
thread
,
NULL
);
memset
(
&
pMnode
->
thread
,
0
,
sizeof
(
pMnode
->
thread
));
}
}
...
...
source/dnode/mnode/impl/test/acct/acct.cpp
浏览文件 @
9a9a1927
...
...
@@ -13,7 +13,7 @@
class
MndTestAcct
:
public
::
testing
::
Test
{
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/
mnode_test_acc
t"
,
9012
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/
acctTes
t"
,
9012
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
...
...
source/dnode/mnode/impl/test/bnode/CMakeLists.txt
浏览文件 @
9a9a1927
aux_source_directory
(
. MNODE_BNODE_TEST_SRC
)
add_executable
(
mbnodeTest
${
MNODE_BNODE_TEST_SRC
}
)
target_link_libraries
(
mbnodeTest
PUBLIC sut
)
#
aux_source_directory(. MNODE_BNODE_TEST_SRC)
#
add_executable(mbnodeTest ${MNODE_BNODE_TEST_SRC})
#
target_link_libraries(
#
mbnodeTest
#
PUBLIC sut
#
)
add_test
(
NAME mbnodeTest
COMMAND mbnodeTest
)
#
add_test(
#
NAME mbnodeTest
#
COMMAND mbnodeTest
#
)
source/dnode/mnode/impl/test/bnode/mbnode.cpp
浏览文件 @
9a9a1927
...
...
@@ -22,7 +22,7 @@ class MndTestBnode : public ::testing::Test {
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9018"
;
server2
.
Start
(
"/tmp/mnode_test_bnode2"
,
fqdn
,
9019
,
firstEp
);
server2
.
Start
(
"/tmp/mnode_test_bnode2"
,
9019
);
taosMsleep
(
300
);
}
...
...
source/dnode/mnode/impl/test/dnode/CMakeLists.txt
浏览文件 @
9a9a1927
aux_source_directory
(
. MNODE_DNODE_TEST_SRC
)
add_executable
(
mdnodeTest
${
MNODE_DNODE_TEST_SRC
}
)
target_link_libraries
(
mdnodeTest
PUBLIC sut
)
#
aux_source_directory(. MNODE_DNODE_TEST_SRC)
#
add_executable(mdnodeTest ${MNODE_DNODE_TEST_SRC})
#
target_link_libraries(
#
mdnodeTest
#
PUBLIC sut
#
)
add_test
(
NAME mdnodeTest
COMMAND mdnodeTest
)
#
add_test(
#
NAME mdnodeTest
#
COMMAND mdnodeTest
#
)
source/dnode/mnode/impl/test/dnode/mdnode.cpp
浏览文件 @
9a9a1927
...
...
@@ -22,10 +22,10 @@ class MndTestDnode : public ::testing::Test {
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9023"
;
server2
.
Start
(
"/tmp/dnode_test_dnode2"
,
fqdn
,
9024
,
firstEp
);
server3
.
Start
(
"/tmp/dnode_test_dnode3"
,
fqdn
,
9025
,
firstEp
);
server4
.
Start
(
"/tmp/dnode_test_dnode4"
,
fqdn
,
9026
,
firstEp
);
server5
.
Start
(
"/tmp/dnode_test_dnode5"
,
fqdn
,
9027
,
firstEp
);
//
server2.Start("/tmp/dnode_test_dnode2", fqdn, 9024, firstEp);
//
server3.Start("/tmp/dnode_test_dnode3", fqdn, 9025, firstEp);
//
server4.Start("/tmp/dnode_test_dnode4", fqdn, 9026, firstEp);
//
server5.Start("/tmp/dnode_test_dnode5", fqdn, 9027, firstEp);
taosMsleep
(
300
);
}
...
...
@@ -205,7 +205,7 @@ TEST_F(MndTestDnode, 04_Drop_Dnode) {
taosMsleep
(
2000
);
server2
.
Stop
();
server2
.
Do
Start
();
server2
.
Start
();
}
TEST_F
(
MndTestDnode
,
05
_Create_Drop_Restart_Dnode
)
{
...
...
source/dnode/mnode/impl/test/mnode/CMakeLists.txt
浏览文件 @
9a9a1927
aux_source_directory
(
. MNODE_MNODE_TEST_SRC
)
add_executable
(
mmnodeTest
${
MNODE_MNODE_TEST_SRC
}
)
target_link_libraries
(
mmnodeTest
PUBLIC sut
)
#
aux_source_directory(. MNODE_MNODE_TEST_SRC)
#
add_executable(mmnodeTest ${MNODE_MNODE_TEST_SRC})
#
target_link_libraries(
#
mmnodeTest
#
PUBLIC sut
#
)
add_test
(
NAME mmnodeTest
COMMAND mmnodeTest
)
#
add_test(
#
NAME mmnodeTest
#
COMMAND mmnodeTest
#
)
source/dnode/mnode/impl/test/mnode/mnode.cpp
浏览文件 @
9a9a1927
...
...
@@ -22,7 +22,7 @@ class MndTestMnode : public ::testing::Test {
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9028"
;
server2
.
Start
(
"/tmp/mnode_test_mnode2"
,
fqdn
,
9029
,
firstEp
);
//
server2.Start("/tmp/mnode_test_mnode2", fqdn, 9029, firstEp);
taosMsleep
(
300
);
}
...
...
@@ -188,7 +188,7 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
{
// server start, wait until the rollback finished
server2
.
Do
Start
();
// server2.
Start();
taosMsleep
(
1000
);
int32_t
retry
=
0
;
...
...
@@ -258,7 +258,7 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
{
// server start, wait until the rollback finished
server2
.
Do
Start
();
// server2.
Start();
taosMsleep
(
1000
);
int32_t
retry
=
0
;
...
...
source/dnode/mnode/impl/test/qnode/CMakeLists.txt
浏览文件 @
9a9a1927
aux_source_directory
(
. MNODE_QNODE_TEST_SRC
)
add_executable
(
mqnodeTest
${
MNODE_QNODE_TEST_SRC
}
)
target_link_libraries
(
mqnodeTest
PUBLIC sut
)
#
aux_source_directory(. MNODE_QNODE_TEST_SRC)
#
add_executable(mqnodeTest ${MNODE_QNODE_TEST_SRC})
#
target_link_libraries(
#
mqnodeTest
#
PUBLIC sut
#
)
add_test
(
NAME mqnodeTest
COMMAND mqnodeTest
)
#
add_test(
#
NAME mqnodeTest
#
COMMAND mqnodeTest
#
)
source/dnode/mnode/impl/test/qnode/qnode.cpp
浏览文件 @
9a9a1927
...
...
@@ -22,7 +22,7 @@ class MndTestQnode : public ::testing::Test {
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9014"
;
server2
.
Start
(
"/tmp/mnode_test_qnode2"
,
fqdn
,
9015
,
firstEp
);
//
server2.Start("/tmp/mnode_test_qnode2", fqdn, 9015, firstEp);
taosMsleep
(
300
);
}
...
...
@@ -201,7 +201,7 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
{
// server start, wait until the rollback finished
server2
.
Do
Start
();
server2
.
Start
();
test
.
ClientRestart
();
taosMsleep
(
1000
);
...
...
@@ -270,7 +270,7 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
{
// server start, wait until the rollback finished
server2
.
Do
Start
();
server2
.
Start
();
taosMsleep
(
1000
);
int32_t
retry
=
0
;
...
...
source/dnode/mnode/impl/test/snode/CMakeLists.txt
浏览文件 @
9a9a1927
aux_source_directory
(
. MNODE_SNODE_TEST_SRC
)
add_executable
(
msnodeTest
${
MNODE_SNODE_TEST_SRC
}
)
target_link_libraries
(
msnodeTest
PUBLIC sut
)
#
aux_source_directory(. MNODE_SNODE_TEST_SRC)
#
add_executable(msnodeTest ${MNODE_SNODE_TEST_SRC})
#
target_link_libraries(
#
msnodeTest
#
PUBLIC sut
#
)
add_test
(
NAME msnodeTest
COMMAND msnodeTest
)
#
add_test(
#
NAME msnodeTest
#
COMMAND msnodeTest
#
)
source/dnode/mnode/impl/test/snode/snode.cpp
浏览文件 @
9a9a1927
...
...
@@ -22,7 +22,7 @@ class MndTestSnode : public ::testing::Test {
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9016"
;
server2
.
Start
(
"/tmp/mnode_test_snode2"
,
fqdn
,
9017
,
firstEp
);
//
server2.Start("/tmp/mnode_test_snode2", fqdn, 9017, firstEp);
taosMsleep
(
300
);
}
...
...
@@ -198,7 +198,7 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
{
// server start, wait until the rollback finished
server2
.
Do
Start
();
server2
.
Start
();
taosMsleep
(
1000
);
int32_t
retry
=
0
;
...
...
@@ -268,7 +268,7 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
{
// server start, wait until the rollback finished
server2
.
Do
Start
();
server2
.
Start
();
taosMsleep
(
1000
);
int32_t
retry
=
0
;
...
...
source/dnode/mnode/impl/test/trans/CMakeLists.txt
浏览文件 @
9a9a1927
add_executable
(
transTest1
""
)
target_sources
(
transTest1
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/trans1.cpp"
)
target_link_libraries
(
transTest1
PUBLIC sut
)
target_include_directories
(
transTest1
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/dnode/mnode"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../inc"
)
add_test
(
NAME transTest1
COMMAND transTest1
)
#
add_executable(transTest1 "")
#
target_sources(transTest1
#
PRIVATE
#
"${CMAKE_CURRENT_SOURCE_DIR}/trans1.cpp"
#
)
#
target_link_libraries(
#
transTest1
#
PUBLIC sut
#
)
#
target_include_directories(
#
transTest1
#
PUBLIC "${TD_SOURCE_DIR}/include/dnode/mnode"
#
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../inc"
#
)
#
add_test(
#
NAME transTest1
#
COMMAND transTest1
#
)
add_executable
(
transTest2
""
)
target_sources
(
transTest2
...
...
source/dnode/mnode/impl/test/trans/trans1.cpp
浏览文件 @
9a9a1927
...
...
@@ -17,7 +17,7 @@ class MndTestTrans1 : public ::testing::Test {
test
.
Init
(
"/tmp/mnode_test_trans1"
,
9013
);
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9013"
;
server2
.
Start
(
"/tmp/mnode_test_trans2"
,
fqdn
,
9020
,
firstEp
);
//
server2.Start("/tmp/mnode_test_trans2", fqdn, 9020, firstEp);
}
static
void
TearDownTestSuite
()
{
...
...
@@ -220,7 +220,7 @@ TEST_F(MndTestTrans1, 03_Create_Qnode2_Crash) {
uInfo
(
"======== kill and restart server"
)
KillThenRestartServer
();
uInfo
(
"======== server2 start"
)
server2
.
Do
Start
();
uInfo
(
"======== server2 start"
)
server2
.
Start
();
uInfo
(
"======== server2 started"
)
...
...
source/dnode/mnode/impl/test/trans/trans2.cpp
浏览文件 @
9a9a1927
...
...
@@ -16,6 +16,13 @@
#include "tcache.h"
void
reportStartup
(
const
char
*
name
,
const
char
*
desc
)
{}
void
sendRsp
(
const
SRpcMsg
*
pMsg
)
{
rpcFreeCont
(
pMsg
->
pCont
);
}
int32_t
sendReq
(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
// rpcFreeCont(pMsg->pCont);
terrno
=
TSDB_CODE_INVALID_PTR
;
return
-
1
;
}
class
MndTestTrans2
:
public
::
testing
::
Test
{
protected:
...
...
@@ -47,6 +54,8 @@ class MndTestTrans2 : public ::testing::Test {
static
void
InitMnode
()
{
static
SMsgCb
msgCb
=
{
0
};
msgCb
.
reportStartupFp
=
reportStartup
;
msgCb
.
sendReqFp
=
sendReq
;
msgCb
.
sendRspFp
=
sendRsp
;
msgCb
.
mgmt
=
(
SMgmtWrapper
*
)(
&
msgCb
);
// hack
tmsgSetDefaultMsgCb
(
&
msgCb
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录