fix: create function bufSize default value 0
This commit is contained in:
parent
81e73f1a35
commit
71188483ec
|
@ -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 {
|
||||||
|
|
||||||
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) {
|
||||||
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) {
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue