minor changes
This commit is contained in:
parent
f17bf4bbd0
commit
f7769b0966
|
@ -7,7 +7,6 @@ add_subdirectory(snode)
|
||||||
# add_subdirectory(auth)
|
# add_subdirectory(auth)
|
||||||
# add_subdirectory(balance)
|
# add_subdirectory(balance)
|
||||||
add_subdirectory(db)
|
add_subdirectory(db)
|
||||||
add_subdirectory(dnode)
|
|
||||||
# add_subdirectory(func)
|
# add_subdirectory(func)
|
||||||
add_subdirectory(mnode)
|
add_subdirectory(mnode)
|
||||||
add_subdirectory(stb)
|
add_subdirectory(stb)
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
aux_source_directory(. DTEST_SRC)
|
|
||||||
add_executable(dnode_test_dnode ${DTEST_SRC})
|
|
||||||
target_link_libraries(
|
|
||||||
dnode_test_dnode
|
|
||||||
PUBLIC sut
|
|
||||||
)
|
|
||||||
|
|
||||||
add_test(
|
|
||||||
NAME dnode_test_dnode
|
|
||||||
COMMAND dnode_test_dnode
|
|
||||||
)
|
|
|
@ -8,3 +8,4 @@ add_subdirectory(snode)
|
||||||
add_subdirectory(bnode)
|
add_subdirectory(bnode)
|
||||||
add_subdirectory(show)
|
add_subdirectory(show)
|
||||||
add_subdirectory(profile)
|
add_subdirectory(profile)
|
||||||
|
add_subdirectory(dnode)
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
aux_source_directory(. DTEST_SRC)
|
||||||
|
add_executable(mnode_test_dnode ${DTEST_SRC})
|
||||||
|
target_link_libraries(
|
||||||
|
mnode_test_dnode
|
||||||
|
PUBLIC sut
|
||||||
|
)
|
||||||
|
|
||||||
|
add_test(
|
||||||
|
NAME mnode_test_dnode
|
||||||
|
COMMAND mnode_test_dnode
|
||||||
|
)
|
|
@ -1,31 +1,31 @@
|
||||||
/**
|
/**
|
||||||
* @file dnode.cpp
|
* @file dnode.cpp
|
||||||
* @author slguan (slguan@taosdata.com)
|
* @author slguan (slguan@taosdata.com)
|
||||||
* @brief DNODE module dnode-msg tests
|
* @brief MNODE module dnode tests
|
||||||
* @version 0.1
|
* @version 1.0
|
||||||
* @date 2021-12-15
|
* @date 2022-01-06
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2021
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sut.h"
|
#include "sut.h"
|
||||||
|
|
||||||
class DndTestDnode : public ::testing::Test {
|
class MndTestDnode : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
void SetUp() override {}
|
void SetUp() override {}
|
||||||
void TearDown() override {}
|
void TearDown() override {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void SetUpTestSuite() {
|
static void SetUpTestSuite() {
|
||||||
test.Init("/tmp/dnode_test_dnode1", 9041);
|
test.Init("/tmp/dnode_test_dnode1", 9023);
|
||||||
const char* fqdn = "localhost";
|
const char* fqdn = "localhost";
|
||||||
const char* firstEp = "localhost:9041";
|
const char* firstEp = "localhost:9023";
|
||||||
|
|
||||||
server2.Start("/tmp/dnode_test_dnode2", fqdn, 9042, firstEp);
|
server2.Start("/tmp/dnode_test_dnode2", fqdn, 9024, firstEp);
|
||||||
server3.Start("/tmp/dnode_test_dnode3", fqdn, 9043, firstEp);
|
server3.Start("/tmp/dnode_test_dnode3", fqdn, 9025, firstEp);
|
||||||
server4.Start("/tmp/dnode_test_dnode4", fqdn, 9044, firstEp);
|
server4.Start("/tmp/dnode_test_dnode4", fqdn, 9026, firstEp);
|
||||||
server5.Start("/tmp/dnode_test_dnode5", fqdn, 9045, firstEp);
|
server5.Start("/tmp/dnode_test_dnode5", fqdn, 9027, firstEp);
|
||||||
taosMsleep(300);
|
taosMsleep(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,13 +44,13 @@ class DndTestDnode : public ::testing::Test {
|
||||||
static TestServer server5;
|
static TestServer server5;
|
||||||
};
|
};
|
||||||
|
|
||||||
Testbase DndTestDnode::test;
|
Testbase MndTestDnode::test;
|
||||||
TestServer DndTestDnode::server2;
|
TestServer MndTestDnode::server2;
|
||||||
TestServer DndTestDnode::server3;
|
TestServer MndTestDnode::server3;
|
||||||
TestServer DndTestDnode::server4;
|
TestServer MndTestDnode::server4;
|
||||||
TestServer DndTestDnode::server5;
|
TestServer MndTestDnode::server5;
|
||||||
|
|
||||||
TEST_F(DndTestDnode, 01_ShowDnode) {
|
TEST_F(MndTestDnode, 01_ShowDnode) {
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, "");
|
test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, "");
|
||||||
CHECK_META("show dnodes", 7);
|
CHECK_META("show dnodes", 7);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ TEST_F(DndTestDnode, 01_ShowDnode) {
|
||||||
EXPECT_EQ(test.GetShowRows(), 1);
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
|
|
||||||
CheckInt16(1);
|
CheckInt16(1);
|
||||||
CheckBinary("localhost:9041", TSDB_EP_LEN);
|
CheckBinary("localhost:9023", TSDB_EP_LEN);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
||||||
CheckInt16(16);
|
CheckInt16(16);
|
||||||
CheckBinary("ready", 10);
|
CheckBinary("ready", 10);
|
||||||
|
@ -74,7 +74,7 @@ TEST_F(DndTestDnode, 01_ShowDnode) {
|
||||||
CheckBinary("", 24);
|
CheckBinary("", 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DndTestDnode, 02_ConfigDnode) {
|
TEST_F(MndTestDnode, 02_ConfigDnode) {
|
||||||
int32_t contLen = sizeof(SCfgDnodeMsg);
|
int32_t contLen = sizeof(SCfgDnodeMsg);
|
||||||
|
|
||||||
SCfgDnodeMsg* pReq = (SCfgDnodeMsg*)rpcMallocCont(contLen);
|
SCfgDnodeMsg* pReq = (SCfgDnodeMsg*)rpcMallocCont(contLen);
|
||||||
|
@ -86,13 +86,13 @@ TEST_F(DndTestDnode, 02_ConfigDnode) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
|
TEST_F(MndTestDnode, 03_Create_Drop_Restart_Dnode) {
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SCreateDnodeMsg);
|
int32_t contLen = sizeof(SCreateDnodeMsg);
|
||||||
|
|
||||||
SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen);
|
SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen);
|
||||||
strcpy(pReq->fqdn, "localhost");
|
strcpy(pReq->fqdn, "localhost");
|
||||||
pReq->port = htonl(9042);
|
pReq->port = htonl(9024);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -108,8 +108,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
|
||||||
|
|
||||||
CheckInt16(1);
|
CheckInt16(1);
|
||||||
CheckInt16(2);
|
CheckInt16(2);
|
||||||
CheckBinary("localhost:9041", TSDB_EP_LEN);
|
CheckBinary("localhost:9023", TSDB_EP_LEN);
|
||||||
CheckBinary("localhost:9042", TSDB_EP_LEN);
|
CheckBinary("localhost:9024", TSDB_EP_LEN);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
||||||
CheckInt16(16);
|
CheckInt16(16);
|
||||||
|
@ -138,7 +138,7 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
|
||||||
EXPECT_EQ(test.GetShowRows(), 1);
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
|
|
||||||
CheckInt16(1);
|
CheckInt16(1);
|
||||||
CheckBinary("localhost:9041", TSDB_EP_LEN);
|
CheckBinary("localhost:9023", TSDB_EP_LEN);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
||||||
CheckInt16(16);
|
CheckInt16(16);
|
||||||
CheckBinary("ready", 10);
|
CheckBinary("ready", 10);
|
||||||
|
@ -150,7 +150,7 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
|
||||||
|
|
||||||
SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen);
|
SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen);
|
||||||
strcpy(pReq->fqdn, "localhost");
|
strcpy(pReq->fqdn, "localhost");
|
||||||
pReq->port = htonl(9043);
|
pReq->port = htonl(9025);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -162,7 +162,7 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
|
||||||
|
|
||||||
SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen);
|
SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen);
|
||||||
strcpy(pReq->fqdn, "localhost");
|
strcpy(pReq->fqdn, "localhost");
|
||||||
pReq->port = htonl(9044);
|
pReq->port = htonl(9026);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -174,7 +174,7 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
|
||||||
|
|
||||||
SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen);
|
SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen);
|
||||||
strcpy(pReq->fqdn, "localhost");
|
strcpy(pReq->fqdn, "localhost");
|
||||||
pReq->port = htonl(9045);
|
pReq->port = htonl(9027);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -191,10 +191,10 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
|
||||||
CheckInt16(3);
|
CheckInt16(3);
|
||||||
CheckInt16(4);
|
CheckInt16(4);
|
||||||
CheckInt16(5);
|
CheckInt16(5);
|
||||||
CheckBinary("localhost:9041", TSDB_EP_LEN);
|
CheckBinary("localhost:9023", TSDB_EP_LEN);
|
||||||
CheckBinary("localhost:9043", TSDB_EP_LEN);
|
CheckBinary("localhost:9025", TSDB_EP_LEN);
|
||||||
CheckBinary("localhost:9044", TSDB_EP_LEN);
|
CheckBinary("localhost:9026", TSDB_EP_LEN);
|
||||||
CheckBinary("localhost:9045", TSDB_EP_LEN);
|
CheckBinary("localhost:9027", TSDB_EP_LEN);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
||||||
|
@ -234,10 +234,10 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) {
|
||||||
CheckInt16(3);
|
CheckInt16(3);
|
||||||
CheckInt16(4);
|
CheckInt16(4);
|
||||||
CheckInt16(5);
|
CheckInt16(5);
|
||||||
CheckBinary("localhost:9041", TSDB_EP_LEN);
|
CheckBinary("localhost:9023", TSDB_EP_LEN);
|
||||||
CheckBinary("localhost:9043", TSDB_EP_LEN);
|
CheckBinary("localhost:9025", TSDB_EP_LEN);
|
||||||
CheckBinary("localhost:9044", TSDB_EP_LEN);
|
CheckBinary("localhost:9026", TSDB_EP_LEN);
|
||||||
CheckBinary("localhost:9045", TSDB_EP_LEN);
|
CheckBinary("localhost:9027", TSDB_EP_LEN);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
||||||
CheckInt16(0);
|
CheckInt16(0);
|
Loading…
Reference in New Issue