Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3f94137d
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3f94137d
编写于
10月 30, 2022
作者:
H
Hui Li
提交者:
GitHub
10月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17760 from taosdata/fix/TD-19815
fix: add catalog API UT cases
上级
24f31b0f
21364c40
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
96 addition
and
0 deletion
+96
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+2
-0
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+94
-0
未找到文件。
source/libs/catalog/src/catalog.c
浏览文件 @
3f94137d
...
...
@@ -1114,6 +1114,7 @@ int32_t catalogGetCachedTableHashVgroup(SCatalog* pCtg, SRequestConnInfo* pConn,
CTG_API_LEAVE
(
ctgGetTbHashVgroup
(
pCtg
,
pConn
,
pTableName
,
pVgroup
,
exists
));
}
#if 0
int32_t catalogGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SCatalogReq* pReq, SMetaData* pRsp) {
CTG_API_ENTER();
...
...
@@ -1176,6 +1177,7 @@ _return:
CTG_API_LEAVE(code);
}
#endif
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
)
{
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
3f94137d
...
...
@@ -63,6 +63,7 @@ enum {
CTGT_RSP_QNODELIST
,
CTGT_RSP_UDF
,
CTGT_RSP_SVRVER
,
CTGT_RSP_DNODElIST
,
CTGT_RSP_TBMETA_NOT_EXIST
,
};
...
...
@@ -702,6 +703,30 @@ void ctgTestRspSvrVer(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRs
pRsp
->
pCont
=
pReq
;
}
void
ctgTestRspDndeList
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
rpcFreeCont
(
pMsg
->
pCont
);
SDnodeListRsp
dRsp
=
{
0
};
dRsp
.
dnodeList
=
taosArrayInit
(
1
,
sizeof
(
SEpSet
));
SEpSet
epSet
=
{
0
};
epSet
.
numOfEps
=
1
;
tstrncpy
(
epSet
.
eps
[
0
].
fqdn
,
"localhost"
,
TSDB_FQDN_LEN
);
epSet
.
eps
[
0
].
port
=
6030
;
(
void
)
taosArrayPush
(
dRsp
.
dnodeList
,
&
epSet
);
int32_t
rspLen
=
tSerializeSDnodeListRsp
(
NULL
,
0
,
&
dRsp
);
void
*
pReq
=
rpcMallocCont
(
rspLen
);
tSerializeSDnodeListRsp
(
pReq
,
rspLen
,
&
dRsp
);
pRsp
->
code
=
0
;
pRsp
->
contLen
=
rspLen
;
pRsp
->
pCont
=
pReq
;
tFreeSDnodeListRsp
(
&
dRsp
);
}
void
ctgTestRspAuto
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
switch
(
pMsg
->
msgType
)
{
...
...
@@ -727,6 +752,9 @@ void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp)
case
TDMT_MND_SERVER_VERSION
:
ctgTestRspSvrVer
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
TDMT_MND_DNODE_LIST
:
ctgTestRspDndeList
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
default:
break
;
}
...
...
@@ -779,6 +807,9 @@ void ctgTestRspByIdx(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp
case
CTGT_RSP_SVRVER
:
ctgTestRspSvrVer
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
CTGT_RSP_DNODElIST
:
ctgTestRspDndeList
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
default:
ctgTestRspAuto
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
...
...
@@ -2948,6 +2979,69 @@ TEST(apiTest, catalogGetServerVersion_test) {
catalogDestroy
();
}
TEST
(
apiTest
,
catalogUpdateTableIndex_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_SVRVER
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
STableIndexRsp
rsp
=
{
0
};
strcpy
(
rsp
.
dbFName
,
ctgTestDbname
);
strcpy
(
rsp
.
tbName
,
ctgTestSTablename
);
rsp
.
suid
=
ctgTestSuid
;
rsp
.
version
=
1
;
code
=
catalogUpdateTableIndex
(
pCtg
,
&
rsp
);
ASSERT_EQ
(
code
,
0
);
catalogDestroy
();
}
TEST
(
apiTest
,
catalogGetDnodeList_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_DNODElIST
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
SArray
*
pList
=
NULL
;
code
=
catalogGetDnodeList
(
pCtg
,
mockPointer
,
&
pList
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
taosArrayGetSize
(
pList
),
1
);
taosArrayDestroy
(
pList
);
catalogDestroy
();
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录