未验证 提交 109eb407 编写于 作者: X Xiaoyu Wang 提交者: GitHub

Merge pull request #20835 from taosdata/feat/table_level_privilege_wxy

fix: catalog unit test
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#ifdef WINDOWS #ifdef WINDOWS
#define TD_USE_WINSOCK #define TD_USE_WINSOCK
#endif #endif
#include "catalogInt.h"
#include "catalog.h" #include "catalog.h"
#include "catalogInt.h"
#include "os.h" #include "os.h"
#include "stub.h" #include "stub.h"
#include "taos.h" #include "taos.h"
...@@ -48,7 +48,7 @@ void ctgTestSetRspCTableMeta(); ...@@ -48,7 +48,7 @@ void ctgTestSetRspCTableMeta();
void ctgTestSetRspSTableMeta(); void ctgTestSetRspSTableMeta();
void ctgTestSetRspMultiSTableMeta(); void ctgTestSetRspMultiSTableMeta();
extern int32_t clientConnRefPool; extern int32_t clientConnRefPool;
enum { enum {
CTGT_RSP_VGINFO = 1, CTGT_RSP_VGINFO = 1,
...@@ -298,7 +298,7 @@ void ctgTestBuildSTableMetaRsp(STableMetaRsp *rspMsg) { ...@@ -298,7 +298,7 @@ void ctgTestBuildSTableMetaRsp(STableMetaRsp *rspMsg) {
void ctgTestRspDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
SUseDbRsp usedbRsp = {0}; SUseDbRsp usedbRsp = {0};
strcpy(usedbRsp.db, ctgTestDbname); strcpy(usedbRsp.db, ctgTestDbname);
usedbRsp.vgVersion = ctgTestVgVersion; usedbRsp.vgVersion = ctgTestVgVersion;
...@@ -343,7 +343,7 @@ void ctgTestRspDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg * ...@@ -343,7 +343,7 @@ void ctgTestRspDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *
void ctgTestRspTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
STableMetaRsp metaRsp = {0}; STableMetaRsp metaRsp = {0};
strcpy(metaRsp.dbFName, ctgTestDbname); strcpy(metaRsp.dbFName, ctgTestDbname);
strcpy(metaRsp.tbName, ctgTestTablename); strcpy(metaRsp.tbName, ctgTestTablename);
...@@ -384,13 +384,13 @@ void ctgTestRspTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg * ...@@ -384,13 +384,13 @@ void ctgTestRspTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *
void ctgTestRspTableMetaNotExist(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspTableMetaNotExist(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
pRsp->code = CTG_ERR_CODE_TABLE_NOT_EXIST; pRsp->code = CTG_ERR_CODE_TABLE_NOT_EXIST;
} }
void ctgTestRspCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
STableMetaRsp metaRsp = {0}; STableMetaRsp metaRsp = {0};
strcpy(metaRsp.dbFName, ctgTestDbname); strcpy(metaRsp.dbFName, ctgTestDbname);
strcpy(metaRsp.tbName, ctgTestCurrentCTableName ? ctgTestCurrentCTableName : ctgTestCTablename); strcpy(metaRsp.tbName, ctgTestCurrentCTableName ? ctgTestCurrentCTableName : ctgTestCTablename);
...@@ -438,7 +438,7 @@ void ctgTestRspCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg ...@@ -438,7 +438,7 @@ void ctgTestRspCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
STableMetaRsp metaRsp = {0}; STableMetaRsp metaRsp = {0};
strcpy(metaRsp.dbFName, ctgTestDbname); strcpy(metaRsp.dbFName, ctgTestDbname);
strcpy(metaRsp.tbName, ctgTestCurrentSTableName ? ctgTestCurrentSTableName : ctgTestSTablename); strcpy(metaRsp.tbName, ctgTestCurrentSTableName ? ctgTestCurrentSTableName : ctgTestSTablename);
...@@ -450,7 +450,7 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg ...@@ -450,7 +450,7 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
metaRsp.sversion = ctgTestSVersion; metaRsp.sversion = ctgTestSVersion;
metaRsp.tversion = ctgTestTVersion; metaRsp.tversion = ctgTestTVersion;
metaRsp.suid = ctgTestSuid; metaRsp.suid = ctgTestSuid;
metaRsp.tuid = ctgTestSuid+1; metaRsp.tuid = ctgTestSuid + 1;
metaRsp.vgId = 0; metaRsp.vgId = 0;
metaRsp.pSchemas = (SSchema *)taosMemoryMalloc((metaRsp.numOfTags + metaRsp.numOfColumns) * sizeof(SSchema)); metaRsp.pSchemas = (SSchema *)taosMemoryMalloc((metaRsp.numOfTags + metaRsp.numOfColumns) * sizeof(SSchema));
...@@ -486,7 +486,7 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg ...@@ -486,7 +486,7 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
void ctgTestRspMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
static int32_t idx = 1; static int32_t idx = 1;
STableMetaRsp metaRsp = {0}; STableMetaRsp metaRsp = {0};
...@@ -536,16 +536,14 @@ void ctgTestRspMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRp ...@@ -536,16 +536,14 @@ void ctgTestRspMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRp
tFreeSTableMetaRsp(&metaRsp); tFreeSTableMetaRsp(&metaRsp);
} }
void ctgTestRspErrIndexInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspErrIndexInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
pRsp->code = TSDB_CODE_MND_DB_INDEX_NOT_EXIST; pRsp->code = TSDB_CODE_MND_DB_INDEX_NOT_EXIST;
pRsp->contLen = 0; pRsp->contLen = 0;
pRsp->pCont = NULL; pRsp->pCont = NULL;
} }
void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
...@@ -553,6 +551,7 @@ void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p ...@@ -553,6 +551,7 @@ void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
strcpy(userRsp.user, ctgTestUsername); strcpy(userRsp.user, ctgTestUsername);
userRsp.version = 1; userRsp.version = 1;
userRsp.superAuth = 1; userRsp.superAuth = 1;
userRsp.enable = 1;
int32_t contLen = tSerializeSGetUserAuthRsp(NULL, 0, &userRsp); int32_t contLen = tSerializeSGetUserAuthRsp(NULL, 0, &userRsp);
void *pReq = rpcMallocCont(contLen); void *pReq = rpcMallocCont(contLen);
...@@ -565,7 +564,7 @@ void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p ...@@ -565,7 +564,7 @@ void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
void ctgTestRspTableCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspTableCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
static int32_t idx = 1; static int32_t idx = 1;
STableCfgRsp tblRsp = {0}; STableCfgRsp tblRsp = {0};
...@@ -600,7 +599,7 @@ void ctgTestRspTableCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p ...@@ -600,7 +599,7 @@ void ctgTestRspTableCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
static int32_t idx = 1; static int32_t idx = 1;
STableIndexRsp tblRsp = {0}; STableIndexRsp tblRsp = {0};
...@@ -611,10 +610,10 @@ void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg ...@@ -611,10 +610,10 @@ void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
STableIndexInfo info = {0}; STableIndexInfo info = {0};
for (int32_t i = 0; i < ctgTestIndexNum; ++i) { for (int32_t i = 0; i < ctgTestIndexNum; ++i) {
info.interval = 1 + i; info.interval = 1 + i;
info.expr = (char*)taosMemoryCalloc(1, 10); info.expr = (char *)taosMemoryCalloc(1, 10);
taosArrayPush(tblRsp.pIndex, &info); taosArrayPush(tblRsp.pIndex, &info);
} }
int32_t contLen = tSerializeSTableIndexRsp(NULL, 0, &tblRsp); int32_t contLen = tSerializeSTableIndexRsp(NULL, 0, &tblRsp);
void *pReq = rpcMallocCont(contLen); void *pReq = rpcMallocCont(contLen);
tSerializeSTableIndexRsp(pReq, contLen, &tblRsp); tSerializeSTableIndexRsp(pReq, contLen, &tblRsp);
...@@ -628,12 +627,12 @@ void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg ...@@ -628,12 +627,12 @@ void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
void ctgTestRspDBCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspDBCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
static int32_t idx = 1; static int32_t idx = 1;
SDbCfgRsp dbRsp = {0}; SDbCfgRsp dbRsp = {0};
dbRsp.numOfVgroups = ctgTestVgNum; dbRsp.numOfVgroups = ctgTestVgNum;
int32_t contLen = tSerializeSDbCfgRsp(NULL, 0, &dbRsp); int32_t contLen = tSerializeSDbCfgRsp(NULL, 0, &dbRsp);
void *pReq = rpcMallocCont(contLen); void *pReq = rpcMallocCont(contLen);
tSerializeSDbCfgRsp(pReq, contLen, &dbRsp); tSerializeSDbCfgRsp(pReq, contLen, &dbRsp);
...@@ -651,7 +650,7 @@ void ctgTestRspQnodeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg * ...@@ -651,7 +650,7 @@ void ctgTestRspQnodeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *
for (int32_t i = 0; i < ctgTestQnodeNum; ++i) { for (int32_t i = 0; i < ctgTestQnodeNum; ++i) {
SQueryNodeLoad nodeLoad = {0}; SQueryNodeLoad nodeLoad = {0};
nodeLoad.addr.nodeId = i; nodeLoad.addr.nodeId = i;
(void)taosArrayPush(qlistRsp.qnodeList, &nodeLoad); (void)taosArrayPush(qlistRsp.qnodeList, &nodeLoad);
} }
...@@ -675,7 +674,7 @@ void ctgTestRspUdfInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pR ...@@ -675,7 +674,7 @@ void ctgTestRspUdfInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pR
SFuncInfo funcInfo = {0}; SFuncInfo funcInfo = {0};
strcpy(funcInfo.name, "func1"); strcpy(funcInfo.name, "func1");
funcInfo.funcType = ctgTestFuncType; funcInfo.funcType = ctgTestFuncType;
(void)taosArrayPush(funcRsp.pFuncInfos, &funcInfo); (void)taosArrayPush(funcRsp.pFuncInfos, &funcInfo);
int32_t rspLen = tSerializeSRetrieveFuncRsp(NULL, 0, &funcRsp); int32_t rspLen = tSerializeSRetrieveFuncRsp(NULL, 0, &funcRsp);
...@@ -694,7 +693,7 @@ void ctgTestRspSvrVer(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRs ...@@ -694,7 +693,7 @@ void ctgTestRspSvrVer(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRs
SServerVerRsp verRsp = {0}; SServerVerRsp verRsp = {0};
strcpy(verRsp.ver, "1.0"); strcpy(verRsp.ver, "1.0");
int32_t rspLen = tSerializeSServerVerRsp(NULL, 0, &verRsp); int32_t rspLen = tSerializeSServerVerRsp(NULL, 0, &verRsp);
void *pReq = rpcMallocCont(rspLen); void *pReq = rpcMallocCont(rspLen);
tSerializeSServerVerRsp(pReq, rspLen, &verRsp); tSerializeSServerVerRsp(pReq, rspLen, &verRsp);
...@@ -713,9 +712,9 @@ void ctgTestRspDndeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p ...@@ -713,9 +712,9 @@ void ctgTestRspDndeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
epSet.numOfEps = 1; epSet.numOfEps = 1;
tstrncpy(epSet.eps[0].fqdn, "localhost", TSDB_FQDN_LEN); tstrncpy(epSet.eps[0].fqdn, "localhost", TSDB_FQDN_LEN);
epSet.eps[0].port = 6030; epSet.eps[0].port = 6030;
(void)taosArrayPush(dRsp.dnodeList, &epSet); (void)taosArrayPush(dRsp.dnodeList, &epSet);
int32_t rspLen = tSerializeSDnodeListRsp(NULL, 0, &dRsp); int32_t rspLen = tSerializeSDnodeListRsp(NULL, 0, &dRsp);
void *pReq = rpcMallocCont(rspLen); void *pReq = rpcMallocCont(rspLen);
tSerializeSDnodeListRsp(pReq, rspLen, &dRsp); tSerializeSDnodeListRsp(pReq, rspLen, &dRsp);
...@@ -727,8 +726,6 @@ void ctgTestRspDndeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p ...@@ -727,8 +726,6 @@ void ctgTestRspDndeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p
tFreeSDnodeListRsp(&dRsp); tFreeSDnodeListRsp(&dRsp);
} }
void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
switch (pMsg->msgType) { switch (pMsg->msgType) {
case TDMT_MND_USE_DB: case TDMT_MND_USE_DB:
...@@ -745,7 +742,7 @@ void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) ...@@ -745,7 +742,7 @@ void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp)
ctgTestRspDBCfg(shandle, pEpSet, pMsg, pRsp); ctgTestRspDBCfg(shandle, pEpSet, pMsg, pRsp);
break; break;
case TDMT_MND_QNODE_LIST: case TDMT_MND_QNODE_LIST:
ctgTestRspQnodeList(shandle, pEpSet, pMsg, pRsp); ctgTestRspQnodeList(shandle, pEpSet, pMsg, pRsp);
break; break;
case TDMT_MND_RETRIEVE_FUNC: case TDMT_MND_RETRIEVE_FUNC:
ctgTestRspUdfInfo(shandle, pEpSet, pMsg, pRsp); ctgTestRspUdfInfo(shandle, pEpSet, pMsg, pRsp);
...@@ -763,7 +760,6 @@ void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) ...@@ -763,7 +760,6 @@ void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp)
return; return;
} }
void ctgTestRspByIdx(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { void ctgTestRspByIdx(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) {
switch (ctgTestRspFunc[ctgTestRspIdx]) { switch (ctgTestRspFunc[ctgTestRspIdx]) {
case CTGT_RSP_VGINFO: case CTGT_RSP_VGINFO:
...@@ -1058,7 +1054,7 @@ void ctgTestSetRspDbVgroupsAndMultiSuperMeta() { ...@@ -1058,7 +1054,7 @@ void ctgTestSetRspDbVgroupsAndMultiSuperMeta() {
void *ctgTestGetDbVgroupThread(void *param) { void *ctgTestGetDbVgroupThread(void *param) {
struct SCatalog *pCtg = (struct SCatalog *)param; struct SCatalog *pCtg = (struct SCatalog *)param;
int32_t code = 0; int32_t code = 0;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SArray *vgList = NULL; SArray *vgList = NULL;
int32_t n = 0; int32_t n = 0;
...@@ -1204,7 +1200,6 @@ void *ctgTestSetCtableMetaThread(void *param) { ...@@ -1204,7 +1200,6 @@ void *ctgTestSetCtableMetaThread(void *param) {
return NULL; return NULL;
} }
void ctgTestFetchRows(TAOS_RES *result, int32_t *rows) { void ctgTestFetchRows(TAOS_RES *result, int32_t *rows) {
TAOS_ROW row; TAOS_ROW row;
int num_fields = taos_num_fields(result); int num_fields = taos_num_fields(result);
...@@ -1220,23 +1215,22 @@ void ctgTestFetchRows(TAOS_RES *result, int32_t *rows) { ...@@ -1220,23 +1215,22 @@ void ctgTestFetchRows(TAOS_RES *result, int32_t *rows) {
} }
} }
void ctgTestExecQuery(TAOS * taos, char* sql, bool fetch, int32_t *rows) { void ctgTestExecQuery(TAOS *taos, char *sql, bool fetch, int32_t *rows) {
TAOS_RES *result = taos_query(taos, sql); TAOS_RES *result = taos_query(taos, sql);
int code = taos_errno(result); int code = taos_errno(result);
ASSERT_EQ(code, 0); ASSERT_EQ(code, 0);
if (fetch) { if (fetch) {
ctgTestFetchRows(result, rows); ctgTestFetchRows(result, rows);
} }
taos_free_result(result); taos_free_result(result);
} }
TEST(tableMeta, normalTable) { TEST(tableMeta, normalTable) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -1372,7 +1366,7 @@ TEST(tableMeta, normalTable) { ...@@ -1372,7 +1366,7 @@ TEST(tableMeta, normalTable) {
TEST(tableMeta, childTableCase) { TEST(tableMeta, childTableCase) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
...@@ -1484,7 +1478,7 @@ TEST(tableMeta, childTableCase) { ...@@ -1484,7 +1478,7 @@ TEST(tableMeta, childTableCase) {
TEST(tableMeta, superTableCase) { TEST(tableMeta, superTableCase) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
...@@ -1626,7 +1620,7 @@ TEST(tableMeta, superTableCase) { ...@@ -1626,7 +1620,7 @@ TEST(tableMeta, superTableCase) {
TEST(tableMeta, rmStbMeta) { TEST(tableMeta, rmStbMeta) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
...@@ -1696,7 +1690,7 @@ TEST(tableMeta, rmStbMeta) { ...@@ -1696,7 +1690,7 @@ TEST(tableMeta, rmStbMeta) {
TEST(tableMeta, updateStbMeta) { TEST(tableMeta, updateStbMeta) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
...@@ -1785,7 +1779,7 @@ TEST(tableMeta, updateStbMeta) { ...@@ -1785,7 +1779,7 @@ TEST(tableMeta, updateStbMeta) {
TEST(getIndexInfo, notExists) { TEST(getIndexInfo, notExists) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -1809,13 +1803,13 @@ TEST(getIndexInfo, notExists) { ...@@ -1809,13 +1803,13 @@ TEST(getIndexInfo, notExists) {
SIndexInfo info; SIndexInfo info;
code = catalogGetIndexMeta(pCtg, mockPointer, "index1", &info); code = catalogGetIndexMeta(pCtg, mockPointer, "index1", &info);
ASSERT_TRUE(code != 0); ASSERT_TRUE(code != 0);
catalogDestroy(); catalogDestroy();
} }
TEST(refreshGetMeta, normal2normal) { TEST(refreshGetMeta, normal2normal) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -1894,7 +1888,7 @@ TEST(refreshGetMeta, normal2normal) { ...@@ -1894,7 +1888,7 @@ TEST(refreshGetMeta, normal2normal) {
TEST(refreshGetMeta, normal2notexist) { TEST(refreshGetMeta, normal2notexist) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -1964,7 +1958,7 @@ TEST(refreshGetMeta, normal2notexist) { ...@@ -1964,7 +1958,7 @@ TEST(refreshGetMeta, normal2notexist) {
TEST(refreshGetMeta, normal2child) { TEST(refreshGetMeta, normal2child) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -2045,10 +2039,9 @@ TEST(refreshGetMeta, normal2child) { ...@@ -2045,10 +2039,9 @@ TEST(refreshGetMeta, normal2child) {
ctgTestCurrentSTableName = NULL; ctgTestCurrentSTableName = NULL;
} }
TEST(refreshGetMeta, stable2child) { TEST(refreshGetMeta, stable2child) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -2134,7 +2127,7 @@ TEST(refreshGetMeta, stable2child) { ...@@ -2134,7 +2127,7 @@ TEST(refreshGetMeta, stable2child) {
TEST(refreshGetMeta, stable2stable) { TEST(refreshGetMeta, stable2stable) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -2220,7 +2213,7 @@ TEST(refreshGetMeta, stable2stable) { ...@@ -2220,7 +2213,7 @@ TEST(refreshGetMeta, stable2stable) {
TEST(refreshGetMeta, child2stable) { TEST(refreshGetMeta, child2stable) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -2306,7 +2299,7 @@ TEST(refreshGetMeta, child2stable) { ...@@ -2306,7 +2299,7 @@ TEST(refreshGetMeta, child2stable) {
TEST(tableDistVgroup, normalTable) { TEST(tableDistVgroup, normalTable) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo *vgInfo = NULL; SVgroupInfo *vgInfo = NULL;
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -2343,7 +2336,7 @@ TEST(tableDistVgroup, normalTable) { ...@@ -2343,7 +2336,7 @@ TEST(tableDistVgroup, normalTable) {
TEST(tableDistVgroup, childTableCase) { TEST(tableDistVgroup, childTableCase) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo *vgInfo = NULL; SVgroupInfo *vgInfo = NULL;
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -2381,7 +2374,7 @@ TEST(tableDistVgroup, childTableCase) { ...@@ -2381,7 +2374,7 @@ TEST(tableDistVgroup, childTableCase) {
TEST(tableDistVgroup, superTableCase) { TEST(tableDistVgroup, superTableCase) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo *vgInfo = NULL; SVgroupInfo *vgInfo = NULL;
SArray *vgList = NULL; SArray *vgList = NULL;
...@@ -2430,7 +2423,7 @@ TEST(tableDistVgroup, superTableCase) { ...@@ -2430,7 +2423,7 @@ TEST(tableDistVgroup, superTableCase) {
TEST(dbVgroup, getSetDbVgroupCase) { TEST(dbVgroup, getSetDbVgroupCase) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL; SVgroupInfo *pvgInfo = NULL;
...@@ -2520,7 +2513,7 @@ TEST(dbVgroup, getSetDbVgroupCase) { ...@@ -2520,7 +2513,7 @@ TEST(dbVgroup, getSetDbVgroupCase) {
TEST(multiThread, getSetRmSameDbVgroup) { TEST(multiThread, getSetRmSameDbVgroup) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL; SVgroupInfo *pvgInfo = NULL;
...@@ -2572,7 +2565,7 @@ TEST(multiThread, getSetRmSameDbVgroup) { ...@@ -2572,7 +2565,7 @@ TEST(multiThread, getSetRmSameDbVgroup) {
TEST(multiThread, getSetRmDiffDbVgroup) { TEST(multiThread, getSetRmDiffDbVgroup) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL; SVgroupInfo *pvgInfo = NULL;
...@@ -2624,7 +2617,7 @@ TEST(multiThread, getSetRmDiffDbVgroup) { ...@@ -2624,7 +2617,7 @@ TEST(multiThread, getSetRmDiffDbVgroup) {
TEST(multiThread, ctableMeta) { TEST(multiThread, ctableMeta) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL; SVgroupInfo *pvgInfo = NULL;
...@@ -2675,7 +2668,7 @@ TEST(multiThread, ctableMeta) { ...@@ -2675,7 +2668,7 @@ TEST(multiThread, ctableMeta) {
TEST(rentTest, allRent) { TEST(rentTest, allRent) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
SVgroupInfo vgInfo = {0}; SVgroupInfo vgInfo = {0};
SVgroupInfo *pvgInfo = NULL; SVgroupInfo *pvgInfo = NULL;
...@@ -2754,7 +2747,7 @@ TEST(rentTest, allRent) { ...@@ -2754,7 +2747,7 @@ TEST(rentTest, allRent) {
TEST(apiTest, catalogRefreshDBVgInfo_test) { TEST(apiTest, catalogRefreshDBVgInfo_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -2781,7 +2774,7 @@ TEST(apiTest, catalogRefreshDBVgInfo_test) { ...@@ -2781,7 +2774,7 @@ TEST(apiTest, catalogRefreshDBVgInfo_test) {
TEST(apiTest, catalogChkAuth_test) { TEST(apiTest, catalogChkAuth_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -2801,7 +2794,7 @@ TEST(apiTest, catalogChkAuth_test) { ...@@ -2801,7 +2794,7 @@ TEST(apiTest, catalogChkAuth_test) {
ASSERT_EQ(code, 0); ASSERT_EQ(code, 0);
SUserAuthInfo authInfo = {0}; SUserAuthInfo authInfo = {0};
SUserAuthRes authRes = {0}; SUserAuthRes authRes = {0};
strcpy(authInfo.user, ctgTestUsername); strcpy(authInfo.user, ctgTestUsername);
toName(1, ctgTestDbname, ctgTestSTablename, &authInfo.tbName); toName(1, ctgTestDbname, ctgTestSTablename, &authInfo.tbName);
authInfo.type = AUTH_TYPE_READ; authInfo.type = AUTH_TYPE_READ;
...@@ -2834,7 +2827,7 @@ TEST(apiTest, catalogChkAuth_test) { ...@@ -2834,7 +2827,7 @@ TEST(apiTest, catalogChkAuth_test) {
TEST(apiTest, catalogRefreshGetTableCfg_test) { TEST(apiTest, catalogRefreshGetTableCfg_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -2872,7 +2865,7 @@ TEST(apiTest, catalogRefreshGetTableCfg_test) { ...@@ -2872,7 +2865,7 @@ TEST(apiTest, catalogRefreshGetTableCfg_test) {
TEST(apiTest, catalogGetTableIndex_test) { TEST(apiTest, catalogGetTableIndex_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -2908,7 +2901,7 @@ TEST(apiTest, catalogGetTableIndex_test) { ...@@ -2908,7 +2901,7 @@ TEST(apiTest, catalogGetTableIndex_test) {
TEST(apiTest, catalogGetDBCfg_test) { TEST(apiTest, catalogGetDBCfg_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -2941,7 +2934,7 @@ TEST(apiTest, catalogGetDBCfg_test) { ...@@ -2941,7 +2934,7 @@ TEST(apiTest, catalogGetDBCfg_test) {
TEST(apiTest, catalogGetQnodeList_test) { TEST(apiTest, catalogGetQnodeList_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -2966,17 +2959,16 @@ TEST(apiTest, catalogGetQnodeList_test) { ...@@ -2966,17 +2959,16 @@ TEST(apiTest, catalogGetQnodeList_test) {
ASSERT_EQ(taosArrayGetSize(qnodeList), ctgTestQnodeNum); ASSERT_EQ(taosArrayGetSize(qnodeList), ctgTestQnodeNum);
for (int32_t i = 0; i < ctgTestQnodeNum; ++i) { for (int32_t i = 0; i < ctgTestQnodeNum; ++i) {
SQueryNodeLoad * pLoad = (SQueryNodeLoad *)taosArrayGet(qnodeList, i); SQueryNodeLoad *pLoad = (SQueryNodeLoad *)taosArrayGet(qnodeList, i);
ASSERT_EQ(pLoad->addr.nodeId, i); ASSERT_EQ(pLoad->addr.nodeId, i);
} }
catalogDestroy(); catalogDestroy();
} }
TEST(apiTest, catalogGetUdfInfo_test) { TEST(apiTest, catalogGetUdfInfo_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -3003,10 +2995,9 @@ TEST(apiTest, catalogGetUdfInfo_test) { ...@@ -3003,10 +2995,9 @@ TEST(apiTest, catalogGetUdfInfo_test) {
catalogDestroy(); catalogDestroy();
} }
TEST(apiTest, catalogGetServerVersion_test) { TEST(apiTest, catalogGetServerVersion_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -3025,7 +3016,7 @@ TEST(apiTest, catalogGetServerVersion_test) { ...@@ -3025,7 +3016,7 @@ TEST(apiTest, catalogGetServerVersion_test) {
code = catalogGetHandle(ctgTestClusterId, &pCtg); code = catalogGetHandle(ctgTestClusterId, &pCtg);
ASSERT_EQ(code, 0); ASSERT_EQ(code, 0);
char* ver = NULL; char *ver = NULL;
code = catalogGetServerVersion(pCtg, mockPointer, &ver); code = catalogGetServerVersion(pCtg, mockPointer, &ver);
ASSERT_EQ(code, 0); ASSERT_EQ(code, 0);
ASSERT_TRUE(0 == strcmp(ver, "1.0")); ASSERT_TRUE(0 == strcmp(ver, "1.0"));
...@@ -3035,7 +3026,7 @@ TEST(apiTest, catalogGetServerVersion_test) { ...@@ -3035,7 +3026,7 @@ TEST(apiTest, catalogGetServerVersion_test) {
TEST(apiTest, catalogUpdateTableIndex_test) { TEST(apiTest, catalogUpdateTableIndex_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -3065,10 +3056,9 @@ TEST(apiTest, catalogUpdateTableIndex_test) { ...@@ -3065,10 +3056,9 @@ TEST(apiTest, catalogUpdateTableIndex_test) {
catalogDestroy(); catalogDestroy();
} }
TEST(apiTest, catalogGetDnodeList_test) { TEST(apiTest, catalogGetDnodeList_test) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
SRequestConnInfo connInfo = {0}; SRequestConnInfo connInfo = {0};
SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo;
ctgTestInitLogFile(); ctgTestInitLogFile();
...@@ -3087,7 +3077,7 @@ TEST(apiTest, catalogGetDnodeList_test) { ...@@ -3087,7 +3077,7 @@ TEST(apiTest, catalogGetDnodeList_test) {
code = catalogGetHandle(ctgTestClusterId, &pCtg); code = catalogGetHandle(ctgTestClusterId, &pCtg);
ASSERT_EQ(code, 0); ASSERT_EQ(code, 0);
SArray* pList = NULL; SArray *pList = NULL;
code = catalogGetDnodeList(pCtg, mockPointer, &pList); code = catalogGetDnodeList(pCtg, mockPointer, &pList);
ASSERT_EQ(code, 0); ASSERT_EQ(code, 0);
ASSERT_EQ(taosArrayGetSize(pList), 1); ASSERT_EQ(taosArrayGetSize(pList), 1);
...@@ -3099,23 +3089,23 @@ TEST(apiTest, catalogGetDnodeList_test) { ...@@ -3099,23 +3089,23 @@ TEST(apiTest, catalogGetDnodeList_test) {
#ifdef INTEGRATION_TEST #ifdef INTEGRATION_TEST
TEST(intTest, autoCreateTableTest) { TEST(intTest, autoCreateTableTest) {
struct SCatalog *pCtg = NULL; struct SCatalog *pCtg = NULL;
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_TRUE(NULL != taos); ASSERT_TRUE(NULL != taos);
ctgdEnableDebug("api", true); ctgdEnableDebug("api", true);
ctgdEnableDebug("meta", true); ctgdEnableDebug("meta", true);
ctgdEnableDebug("cache", true); ctgdEnableDebug("cache", true);
ctgdEnableDebug("lock", true); ctgdEnableDebug("lock", true);
ctgTestExecQuery(taos, "drop database if exists db1", false, NULL); ctgTestExecQuery(taos, "drop database if exists db1", false, NULL);
ctgTestExecQuery(taos, "create database db1", false, NULL); ctgTestExecQuery(taos, "create database db1", false, NULL);
ctgTestExecQuery(taos, "create stable db1.st1 (ts timestamp, f1 int) tags(tg1 int)", false, NULL); ctgTestExecQuery(taos, "create stable db1.st1 (ts timestamp, f1 int) tags(tg1 int)", false, NULL);
ctgTestExecQuery(taos, "insert into db1.tb1 using db1.st1 tags(1) values(now, 1)", false, NULL); ctgTestExecQuery(taos, "insert into db1.tb1 using db1.st1 tags(1) values(now, 1)", false, NULL);
ctgdGetOneHandle(&pCtg); ctgdGetOneHandle(&pCtg);
while (true) { while (true) {
uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM);
if (2 != n) { if (2 != n) {
...@@ -3141,15 +3131,14 @@ TEST(intTest, autoCreateTableTest) { ...@@ -3141,15 +3131,14 @@ TEST(intTest, autoCreateTableTest) {
ctgTestExecQuery(taos, "alter table db1.st1 add column f2 double", false, NULL); ctgTestExecQuery(taos, "alter table db1.st1 add column f2 double", false, NULL);
ctgdEnableDebug("stopUpdate", false); ctgdEnableDebug("stopUpdate", false);
ctgTestExecQuery(taos, "insert into db1.tb1 (ts, f1) values(now, 4)", false, NULL); ctgTestExecQuery(taos, "insert into db1.tb1 (ts, f1) values(now, 4)", false, NULL);
taos_close(taos); taos_close(taos);
} }
#endif #endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册