fix: test case

This commit is contained in:
factosea 2025-03-02 22:45:58 +08:00
parent 36bec2c958
commit 6da2e6f547
4 changed files with 70 additions and 2 deletions

View File

@ -5833,8 +5833,13 @@ int32_t tDeserializeSShowVariablesReq(void *buf, int32_t bufLen, SShowVariablesR
TAOS_CHECK_EXIT(tStartDecode(&decoder));
TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->opType));
TAOS_CHECK_EXIT(tDecodeU32(&decoder, &pReq->valLen));
if (pReq->valLen > 0) {
TAOS_CHECK_EXIT(tDecodeBinary(&decoder, (uint8_t **)&pReq->val, &pReq->valLen));
pReq->val = taosMemoryCalloc(1, pReq->valLen + 1);
if (pReq->val == NULL) {
TAOS_CHECK_EXIT(terrno);
}
TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, pReq->val));
}
tEndDecode(&decoder);

View File

@ -936,6 +936,7 @@ _OVER:
if (code != 0) {
mError("failed to get show variables info since %s", tstrerror(code));
}
tFreeSShowVariablesReq(&req);
tFreeSShowVariablesRsp(&rsp);
TAOS_RETURN(code);
}

View File

@ -13251,7 +13251,9 @@ static int32_t translateShowVariables(STranslateContext* pCxt, SShowStmt* pStmt)
req.val = taosStrdupi(((SValueNode*)pStmt->pTbName)->literal);
}
}
return buildCmdMsg(pCxt, TDMT_MND_SHOW_VARIABLES, (FSerializeFunc)tSerializeSShowVariablesReq, &req);
int32_t code = buildCmdMsg(pCxt, TDMT_MND_SHOW_VARIABLES, (FSerializeFunc)tSerializeSShowVariablesReq, &req);
tFreeSShowVariablesReq(&req);
return code;
}
static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateDatabaseStmt* pStmt) {

View File

@ -85,7 +85,59 @@ class TDTestCase:
tdSql.checkData(0, 0, 1)
tdSql.checkData(0, 1, 's3UploadDelaySec')
tdSql.checkData(0, 2, 60)
def show_local_variables_like(self):
tdSql.query("show local variables")
tdSql.checkRows(85)
tdSql.query("show local variables like 'debugFlag'")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 'debugFlag')
tdSql.checkData(0, 1, 0)
tdSql.query("show local variables like '%debugFlag'")
tdSql.checkRows(9)
tdSql.query("show local variables like '____debugFlag'")
tdSql.checkRows(0)
tdSql.query("show local variables like 's3MigrateEnab%'")
tdSql.checkRows(0)
tdSql.query("show local variables like 'mini%'")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 'minimalTmpDirGB')
tdSql.query("show local variables like '%info'")
tdSql.checkRows(2)
def show_cluster_variables_like(self):
zones = ["", "cluster"]
for zone in zones:
tdLog.info(f"show {zone} variables")
tdSql.query(f"show {zone} variables")
tdSql.checkRows(87)
tdLog.info(f"show {zone} variables like 'debugFlag'")
#tdSql.query(f"show {zone} variables like 'debugFlag'")
#tdSql.checkRows(0)
tdSql.query(f"show {zone} variables like 's3%'")
tdSql.checkRows(6)
tdSql.query(f"show {zone} variables like 'Max%'")
tdSql.checkRows(3)
tdSql.query(f"show {zone} variables like 'ttl%'")
tdSql.checkRows(5)
tdSql.query(f"show {zone} variables like 'ttl34343434%'")
tdSql.checkRows(0)
tdSql.query(f"show {zone} variables like 'jdlkfdjdfkdfnldlfdnfkdkfdmfdlfmnnnnnjkjk'")
tdSql.checkRows(0)
def threadTest(self, threadID):
print(f"Thread {threadID} starting...")
tdsqln = tdCom.newTdSql()
@ -127,6 +179,14 @@ class TDTestCase:
tdLog.printNoPrefix("==========start case3 run ...............")
self.case3()
tdLog.printNoPrefix("==========end case3 run ...............")
tdLog.printNoPrefix("==========start show_local_variables_like run ...............")
self.show_local_variables_like()
tdLog.printNoPrefix("==========end show_local_variables_like run ...............")
tdLog.printNoPrefix("==========start show_cluster_variables_like run ...............")
self.show_cluster_variables_like()
tdLog.printNoPrefix("==========end show_cluster_variables_like run ...............")
def stop(self):
tdSql.close()