From 4224343001f93ffc2d84e04a8ee4712ec22ccae9 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 27 Dec 2021 01:14:20 -0800 Subject: [PATCH] add test cases --- source/dnode/mgmt/impl/src/dndDnode.c | 20 ++++++++------------ source/dnode/mgmt/impl/test/sut/src/base.cpp | 3 ++- tests/script/general/db/basic1.sim | 7 +++++++ tests/script/general/table/basic1.sim | 9 +++++++++ tests/script/jenkins/basic.txt | 2 ++ 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/source/dnode/mgmt/impl/src/dndDnode.c b/source/dnode/mgmt/impl/src/dndDnode.c index c67e55f048..ca0552b8ad 100644 --- a/source/dnode/mgmt/impl/src/dndDnode.c +++ b/source/dnode/mgmt/impl/src/dndDnode.c @@ -17,6 +17,7 @@ #include "dndDnode.h" #include "dndTransport.h" #include "dndVnodes.h" +#include "dndMnode.h" static int32_t dndInitMgmtWorker(SDnode *pDnode); static void dndCleanupMgmtWorker(SDnode *pDnode); @@ -28,10 +29,10 @@ static int32_t dndReadDnodes(SDnode *pDnode); static int32_t dndWriteDnodes(SDnode *pDnode); static void *dnodeThreadRoutine(void *param); -static void dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pMsg); -static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pMsg); -static void dndProcessAuthRsp(SDnode *pDnode, SRpcMsg *pMsg); -static void dndProcessGrantRsp(SDnode *pDnode, SRpcMsg *pMsg); +static int32_t dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pMsg); +static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pMsg); +static void dndProcessAuthRsp(SDnode *pDnode, SRpcMsg *pMsg); +static void dndProcessGrantRsp(SDnode *pDnode, SRpcMsg *pMsg); int32_t dndGetDnodeId(SDnode *pDnode) { SDnodeMgmt *pMgmt = &pDnode->dmgmt; @@ -458,13 +459,11 @@ static void dndProcessAuthRsp(SDnode *pDnode, SRpcMsg *pMsg) { assert(1); } static void dndProcessGrantRsp(SDnode *pDnode, SRpcMsg *pMsg) { assert(1); } -static void dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pMsg) { +static int32_t dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pMsg) { dError("config msg is received, but not supported yet"); SCfgDnodeMsg *pCfg = pMsg->pCont; - int32_t code = TSDB_CODE_OPS_NOT_SUPPORT; - SRpcMsg rspMsg = {.handle = pMsg->handle, .pCont = NULL, .contLen = 0, .code = code}; - rpcSendResponse(&rspMsg); + return TSDB_CODE_OPS_NOT_SUPPORT; } void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pMsg) { @@ -646,11 +645,8 @@ static void dndProcessMgmtQueue(SDnode *pDnode, SRpcMsg *pMsg) { case TDMT_DND_DROP_MNODE: code = dndProcessDropMnodeReq(pDnode, pMsg); break; - case TDMT_DND_NETWORK_TEST: - dndProcessStartupReq(pDnode, pMsg); - break; case TDMT_DND_CONFIG_DNODE: - dndProcessConfigDnodeReq(pDnode, pMsg); + code = dndProcessConfigDnodeReq(pDnode, pMsg); break; case TDMT_MND_STATUS_RSP: dndProcessStatusRsp(pDnode, pMsg); diff --git a/source/dnode/mgmt/impl/test/sut/src/base.cpp b/source/dnode/mgmt/impl/test/sut/src/base.cpp index f3fe8cfa86..98371e9893 100644 --- a/source/dnode/mgmt/impl/test/sut/src/base.cpp +++ b/source/dnode/mgmt/impl/test/sut/src/base.cpp @@ -31,6 +31,7 @@ void Testbase::InitLog(const char* path) { tsdbDebugFlag = 0; cqDebugFlag = 0; tscEmbeddedInUtil = 1; + tsAsyncLog = 0; taosRemoveDir(path); taosMkDir(path); @@ -47,7 +48,7 @@ void Testbase::Init(const char* path, int16_t port) { char firstEp[TSDB_EP_LEN] = {0}; snprintf(firstEp, TSDB_EP_LEN, "%s:%u", fqdn, port); - InitLog("/tmp/tdlog"); + InitLog("/tmp/td"); server.Start(path, fqdn, port, firstEp); client.Init("root", "taosdata", fqdn, port); taosMsleep(1100); diff --git a/tests/script/general/db/basic1.sim b/tests/script/general/db/basic1.sim index 666a9dfd9e..618b1377b8 100644 --- a/tests/script/general/db/basic1.sim +++ b/tests/script/general/db/basic1.sim @@ -58,4 +58,11 @@ if $data03 != 0 then return -1 endi +print =============== show vgroups +sql use d4 + +if $rows == 0 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/table/basic1.sim b/tests/script/general/table/basic1.sim index ded8d79a3f..04e44f7308 100644 --- a/tests/script/general/table/basic1.sim +++ b/tests/script/general/table/basic1.sim @@ -23,6 +23,15 @@ endi print $data00 $data01 $data02 +sql create table st2 (ts timestamp, i float) tags (j bigint) +sql show stables +if $rows != 2 then + return -1 +endi + +print $data00 $data01 $data02 +print $data00 $data11 $data12 + return print =============== create child table diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 1cc15f731d..0ef43aaced 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -7,5 +7,7 @@ # ---- db ./test.sh -f general/db/basic1.sim +# ---- table +./test.sh -f general/table/basic1.sim #======================b1-end=============== -- GitLab