提交 71188483 编写于 作者: S slzhou

fix: create function bufSize default value 0

上级 81e73f1a
...@@ -314,7 +314,7 @@ static int32_t mndProcessCreateFuncReq(SNodeMsg *pReq) { ...@@ -314,7 +314,7 @@ static int32_t mndProcessCreateFuncReq(SNodeMsg *pReq) {
goto _OVER; goto _OVER;
} }
if (createReq.bufSize <= 0 || createReq.bufSize > TSDB_FUNC_BUF_SIZE) { if (createReq.bufSize < 0 || createReq.bufSize > TSDB_FUNC_BUF_SIZE) {
terrno = TSDB_CODE_MND_INVALID_FUNC_BUFSIZE; terrno = TSDB_CODE_MND_INVALID_FUNC_BUFSIZE;
goto _OVER; goto _OVER;
} }
......
...@@ -24,6 +24,7 @@ class MndTestFunc : public ::testing::Test { ...@@ -24,6 +24,7 @@ class MndTestFunc : public ::testing::Test {
void SetCode(SCreateFuncReq* pReq, const char* pCode, int32_t size); void SetCode(SCreateFuncReq* pReq, const char* pCode, int32_t size);
void SetComment(SCreateFuncReq* pReq, const char* pComment); void SetComment(SCreateFuncReq* pReq, const char* pComment);
void SetBufSize(SCreateFuncReq* pReq, int32_t size);
}; };
Testbase MndTestFunc::test; Testbase MndTestFunc::test;
...@@ -40,6 +41,10 @@ void MndTestFunc::SetComment(SCreateFuncReq* pReq, const char* pComment) { ...@@ -40,6 +41,10 @@ void MndTestFunc::SetComment(SCreateFuncReq* pReq, const char* pComment) {
strcpy(pReq->pComment, pComment); strcpy(pReq->pComment, pComment);
} }
void MndTestFunc::SetBufSize(SCreateFuncReq* pReq, int32_t size) {
pReq->bufSize = size;
}
TEST_F(MndTestFunc, 01_Show_Func) { TEST_F(MndTestFunc, 01_Show_Func) {
test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", ""); test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "user_functions", "");
EXPECT_EQ(test.GetShowRows(), 0); EXPECT_EQ(test.GetShowRows(), 0);
...@@ -96,6 +101,7 @@ TEST_F(MndTestFunc, 02_Create_Func) { ...@@ -96,6 +101,7 @@ TEST_F(MndTestFunc, 02_Create_Func) {
strcpy(createReq.name, "f1"); strcpy(createReq.name, "f1");
SetCode(&createReq, "code1", 6); SetCode(&createReq, "code1", 6);
SetComment(&createReq, "comment1"); SetComment(&createReq, "comment1");
SetBufSize(&createReq, -1);
int32_t contLen = tSerializeSCreateFuncReq(NULL, 0, &createReq); int32_t contLen = tSerializeSCreateFuncReq(NULL, 0, &createReq);
void* pReq = rpcMallocCont(contLen); void* pReq = rpcMallocCont(contLen);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册