From f7769b0966e19c4cd0ecba3d94a3e2de5bd2db5b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 6 Jan 2022 00:57:08 -0800 Subject: [PATCH] minor changes --- source/dnode/mgmt/impl/test/CMakeLists.txt | 1 - .../dnode/mgmt/impl/test/dnode/CMakeLists.txt | 11 --- source/dnode/mnode/impl/test/CMakeLists.txt | 1 + .../mnode/impl/test/dnode/CMakeLists.txt | 11 +++ .../{mgmt => mnode}/impl/test/dnode/dnode.cpp | 70 +++++++++---------- 5 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 source/dnode/mgmt/impl/test/dnode/CMakeLists.txt create mode 100644 source/dnode/mnode/impl/test/dnode/CMakeLists.txt rename source/dnode/{mgmt => mnode}/impl/test/dnode/dnode.cpp (78%) diff --git a/source/dnode/mgmt/impl/test/CMakeLists.txt b/source/dnode/mgmt/impl/test/CMakeLists.txt index 7bab93aeb8..26327d2c4c 100644 --- a/source/dnode/mgmt/impl/test/CMakeLists.txt +++ b/source/dnode/mgmt/impl/test/CMakeLists.txt @@ -7,7 +7,6 @@ add_subdirectory(snode) # add_subdirectory(auth) # add_subdirectory(balance) add_subdirectory(db) -add_subdirectory(dnode) # add_subdirectory(func) add_subdirectory(mnode) add_subdirectory(stb) diff --git a/source/dnode/mgmt/impl/test/dnode/CMakeLists.txt b/source/dnode/mgmt/impl/test/dnode/CMakeLists.txt deleted file mode 100644 index 5796590865..0000000000 --- a/source/dnode/mgmt/impl/test/dnode/CMakeLists.txt +++ /dev/null @@ -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 -) diff --git a/source/dnode/mnode/impl/test/CMakeLists.txt b/source/dnode/mnode/impl/test/CMakeLists.txt index 84e3ce63f9..ddd0869161 100644 --- a/source/dnode/mnode/impl/test/CMakeLists.txt +++ b/source/dnode/mnode/impl/test/CMakeLists.txt @@ -8,3 +8,4 @@ add_subdirectory(snode) add_subdirectory(bnode) add_subdirectory(show) add_subdirectory(profile) +add_subdirectory(dnode) diff --git a/source/dnode/mnode/impl/test/dnode/CMakeLists.txt b/source/dnode/mnode/impl/test/dnode/CMakeLists.txt new file mode 100644 index 0000000000..e29c5e8f3d --- /dev/null +++ b/source/dnode/mnode/impl/test/dnode/CMakeLists.txt @@ -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 +) diff --git a/source/dnode/mgmt/impl/test/dnode/dnode.cpp b/source/dnode/mnode/impl/test/dnode/dnode.cpp similarity index 78% rename from source/dnode/mgmt/impl/test/dnode/dnode.cpp rename to source/dnode/mnode/impl/test/dnode/dnode.cpp index 51af008fc3..c5f29183e9 100644 --- a/source/dnode/mgmt/impl/test/dnode/dnode.cpp +++ b/source/dnode/mnode/impl/test/dnode/dnode.cpp @@ -1,31 +1,31 @@ /** * @file dnode.cpp * @author slguan (slguan@taosdata.com) - * @brief DNODE module dnode-msg tests - * @version 0.1 - * @date 2021-12-15 + * @brief MNODE module dnode tests + * @version 1.0 + * @date 2022-01-06 * - * @copyright Copyright (c) 2021 + * @copyright Copyright (c) 2022 * */ #include "sut.h" -class DndTestDnode : public ::testing::Test { +class MndTestDnode : public ::testing::Test { public: void SetUp() override {} void TearDown() override {} public: static void SetUpTestSuite() { - test.Init("/tmp/dnode_test_dnode1", 9041); + test.Init("/tmp/dnode_test_dnode1", 9023); const char* fqdn = "localhost"; - const char* firstEp = "localhost:9041"; + const char* firstEp = "localhost:9023"; - server2.Start("/tmp/dnode_test_dnode2", fqdn, 9042, firstEp); - server3.Start("/tmp/dnode_test_dnode3", fqdn, 9043, firstEp); - server4.Start("/tmp/dnode_test_dnode4", fqdn, 9044, firstEp); - server5.Start("/tmp/dnode_test_dnode5", fqdn, 9045, 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); } @@ -44,13 +44,13 @@ class DndTestDnode : public ::testing::Test { static TestServer server5; }; -Testbase DndTestDnode::test; -TestServer DndTestDnode::server2; -TestServer DndTestDnode::server3; -TestServer DndTestDnode::server4; -TestServer DndTestDnode::server5; +Testbase MndTestDnode::test; +TestServer MndTestDnode::server2; +TestServer MndTestDnode::server3; +TestServer MndTestDnode::server4; +TestServer MndTestDnode::server5; -TEST_F(DndTestDnode, 01_ShowDnode) { +TEST_F(MndTestDnode, 01_ShowDnode) { test.SendShowMetaReq(TSDB_MGMT_TABLE_DNODE, ""); CHECK_META("show dnodes", 7); @@ -66,7 +66,7 @@ TEST_F(DndTestDnode, 01_ShowDnode) { EXPECT_EQ(test.GetShowRows(), 1); CheckInt16(1); - CheckBinary("localhost:9041", TSDB_EP_LEN); + CheckBinary("localhost:9023", TSDB_EP_LEN); CheckInt16(0); CheckInt16(16); CheckBinary("ready", 10); @@ -74,7 +74,7 @@ TEST_F(DndTestDnode, 01_ShowDnode) { CheckBinary("", 24); } -TEST_F(DndTestDnode, 02_ConfigDnode) { +TEST_F(MndTestDnode, 02_ConfigDnode) { int32_t contLen = sizeof(SCfgDnodeMsg); SCfgDnodeMsg* pReq = (SCfgDnodeMsg*)rpcMallocCont(contLen); @@ -86,13 +86,13 @@ TEST_F(DndTestDnode, 02_ConfigDnode) { 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); SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen); strcpy(pReq->fqdn, "localhost"); - pReq->port = htonl(9042); + pReq->port = htonl(9024); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -108,8 +108,8 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { CheckInt16(1); CheckInt16(2); - CheckBinary("localhost:9041", TSDB_EP_LEN); - CheckBinary("localhost:9042", TSDB_EP_LEN); + CheckBinary("localhost:9023", TSDB_EP_LEN); + CheckBinary("localhost:9024", TSDB_EP_LEN); CheckInt16(0); CheckInt16(0); CheckInt16(16); @@ -138,7 +138,7 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { EXPECT_EQ(test.GetShowRows(), 1); CheckInt16(1); - CheckBinary("localhost:9041", TSDB_EP_LEN); + CheckBinary("localhost:9023", TSDB_EP_LEN); CheckInt16(0); CheckInt16(16); CheckBinary("ready", 10); @@ -150,7 +150,7 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen); strcpy(pReq->fqdn, "localhost"); - pReq->port = htonl(9043); + pReq->port = htonl(9025); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -162,7 +162,7 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen); strcpy(pReq->fqdn, "localhost"); - pReq->port = htonl(9044); + pReq->port = htonl(9026); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -174,7 +174,7 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { SCreateDnodeMsg* pReq = (SCreateDnodeMsg*)rpcMallocCont(contLen); strcpy(pReq->fqdn, "localhost"); - pReq->port = htonl(9045); + pReq->port = htonl(9027); SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_DNODE, pReq, contLen); ASSERT_NE(pRsp, nullptr); @@ -191,10 +191,10 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { CheckInt16(3); CheckInt16(4); CheckInt16(5); - CheckBinary("localhost:9041", TSDB_EP_LEN); - CheckBinary("localhost:9043", TSDB_EP_LEN); - CheckBinary("localhost:9044", TSDB_EP_LEN); - CheckBinary("localhost:9045", TSDB_EP_LEN); + CheckBinary("localhost:9023", TSDB_EP_LEN); + CheckBinary("localhost:9025", TSDB_EP_LEN); + CheckBinary("localhost:9026", TSDB_EP_LEN); + CheckBinary("localhost:9027", TSDB_EP_LEN); CheckInt16(0); CheckInt16(0); CheckInt16(0); @@ -234,10 +234,10 @@ TEST_F(DndTestDnode, 03_Create_Drop_Restart_Dnode) { CheckInt16(3); CheckInt16(4); CheckInt16(5); - CheckBinary("localhost:9041", TSDB_EP_LEN); - CheckBinary("localhost:9043", TSDB_EP_LEN); - CheckBinary("localhost:9044", TSDB_EP_LEN); - CheckBinary("localhost:9045", TSDB_EP_LEN); + CheckBinary("localhost:9023", TSDB_EP_LEN); + CheckBinary("localhost:9025", TSDB_EP_LEN); + CheckBinary("localhost:9026", TSDB_EP_LEN); + CheckBinary("localhost:9027", TSDB_EP_LEN); CheckInt16(0); CheckInt16(0); CheckInt16(0);