feat:[TD-32642] add test case for charset

This commit is contained in:
wangmm0220 2024-12-04 18:50:52 +08:00
parent 931a40985c
commit f338357477
18 changed files with 158 additions and 37 deletions

View File

@ -27,6 +27,7 @@
#define epoll_ctl EPOLL_CTL_FUNC_TAOS_FORBID
#define epoll_wait EPOLL_WAIT_FUNC_TAOS_FORBID
#define inet_ntoa INET_NTOA_FUNC_TAOS_FORBID
#define inet_addr INET_ADDR_FUNC_TAOS_FORBID
#endif
#if defined(WINDOWS)
@ -54,7 +55,6 @@
#define __BIG_ENDIAN BIG_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#define __PDP_ENDIAN PDP_ENDIAN
#include <winsock2.h>
#else
#include <netinet/in.h>
#include <sys/socket.h>
@ -162,9 +162,10 @@ int32_t taosGetSocketName(TdSocketPtr pSocket, struct sockaddr *destAddr, int *a
int32_t taosBlockSIGPIPE();
int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t *ip);
int32_t taosGetFqdn(char *);
void tinet_ntoa(char *ipstr, uint32_t ip);
void taosInetNtoa(char *ipstr, uint32_t ip);
uint32_t taosInetAddr(const char *ipstr);
int32_t taosIgnSIGPIPE();
const char *taosInetNtoa(struct in_addr ipInt, char *dstStr, int32_t len);
const char *taosInetNtop(struct in_addr ipInt, char *dstStr, int32_t len);
uint64_t taosHton64(uint64_t val);
uint64_t taosNtoh64(uint64_t val);

View File

@ -2306,7 +2306,8 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo) {
int32_t length = taosUcs4ToMbs((TdUcs4*)varDataVal(jsonInnerData), varDataLen(jsonInnerData),
varDataVal(dst) + CHAR_BYTES, pResultInfo->charsetCxt);
if (length <= 0) {
tscError("charset:%s to %s. convert failed.", DEFAULT_UNICODE_ENCODEC, tsCharset);
tscError("charset:%s to %s. convert failed.", DEFAULT_UNICODE_ENCODEC,
pResultInfo->charsetCxt != NULL ? ((SConvInfo *)(pResultInfo->charsetCxt))->charset : tsCharset);
length = 0;
}
varDataSetLen(dst, length + CHAR_BYTES * 2);

View File

@ -203,7 +203,7 @@ static int32_t setConnectionOption(TAOS *taos, TSDB_OPTION_CONNECTION option, co
if (option == TSDB_OPTION_CONNECTION_USER_IP || option == TSDB_OPTION_CONNECTION_CLEAR) {
if (val != NULL) {
pObj->optionInfo.userIp = inet_addr(val);
pObj->optionInfo.userIp = taosInetAddr(val);
if (pObj->optionInfo.userIp == INADDR_NONE){
code = TSDB_CODE_INVALID_PARA;
goto END;

View File

@ -11,9 +11,9 @@ TARGET_LINK_LIBRARIES(
os util common transport parser catalog scheduler gtest ${TAOS_LIB_STATIC} qcom executor function
)
ADD_EXECUTABLE(timezoneTest timezoneTest.cpp)
ADD_EXECUTABLE(connectOptionsTest connectOptionsTest.cpp)
TARGET_LINK_LIBRARIES(
timezoneTest
connectOptionsTest
os util common transport parser catalog scheduler gtest ${TAOS_LIB_STATIC} qcom executor function
)
@ -48,7 +48,7 @@ TARGET_INCLUDE_DIRECTORIES(
)
TARGET_INCLUDE_DIRECTORIES(
timezoneTest
connectOptionsTest
PUBLIC "${TD_SOURCE_DIR}/include/client/"
PRIVATE "${TD_SOURCE_DIR}/source/client/inc"
)
@ -94,6 +94,6 @@ add_test(
)
add_test(
NAME timezoneTest
COMMAND timezoneTest
NAME connectOptionsTest
COMMAND connectOptionsTest
)

View File

@ -116,7 +116,7 @@ void check_sql_result(TAOS* pConn, const char *sql, const char* result){
ASSERT(taos_errno(pRes) == 0);
TAOS_ROW row = NULL;
while ((row = taos_fetch_row(pRes)) != NULL) {
ASSERT (strcmp((const char*)row[0], result) == 0);
ASSERT (memcmp((const char*)row[0], result, strlen(result)) == 0);
}
taos_free_result(pRes);
}
@ -195,11 +195,11 @@ void check_set_timezone(TAOS* optionFunc(const char *tz)){
STscObj* pObj = acquireTscObj(*(int64_t*)taos); \
ASSERT(pObj != nullptr); \
char ip[TD_IP_LEN] = {0}; \
tinet_ntoa(ip, pObj->optionInfo.option); \
taosInetNtoa(ip, pObj->optionInfo.option); \
ASSERT(strcmp(ip, val) == 0); \
}
TEST(timezoneCase, setConnectionOption_Test) {
TEST(connectionCase, setConnectionOption_Test) {
int32_t code = taos_options_connection(NULL, TSDB_OPTION_CONNECTION_CHARSET, NULL);
ASSERT(code != 0);
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
@ -223,6 +223,7 @@ TEST(timezoneCase, setConnectionOption_Test) {
ASSERT(code == 0);
CHECK_TAOS_OPTION_POINTER(pConn, charsetCxt, false);
#ifndef WINDOWS
// test timezone
code = taos_options_connection(pConn, TSDB_OPTION_CONNECTION_TIMEZONE, "");
ASSERT(code == 0);
@ -248,6 +249,7 @@ TEST(timezoneCase, setConnectionOption_Test) {
ASSERT(code == 0);
CHECK_TAOS_OPTION_POINTER(pConn, timezone, false);
check_sql_result(pConn, "select timezone()", "adbc (UTC, +0000)");
#endif
// test user APP
code = taos_options_connection(pConn, TSDB_OPTION_CONNECTION_USER_APP, "");
@ -309,14 +311,99 @@ TEST(timezoneCase, setConnectionOption_Test) {
code = taos_options_connection(pConn, TSDB_OPTION_CONNECTION_CLEAR, "192.168.0.2");
ASSERT(code == 0);
CHECK_TAOS_OPTION_POINTER(pConn, charsetCxt, true);
#ifndef WINDOWS
CHECK_TAOS_OPTION_POINTER(pConn, timezone, true);
check_sql_result(pConn, "select timezone()", "Asia/Shanghai (CST, +0800)");
#endif
CHECK_TAOS_OPTION_APP(pConn, userApp, "");
CHECK_TAOS_OPTION_IP_ERROR(pConn, userIp, INADDR_NONE);
taos_close(pConn);
}
TEST(charsetCase, charset_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT(pConn != nullptr);
TAOS* pConnUTF8 = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT(pConnUTF8 != nullptr);
TAOS* pConnDefault = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT(pConnDefault != nullptr);
int32_t code = taos_options_connection(pConn, TSDB_OPTION_CONNECTION_CHARSET, "gbk");
ASSERT(code == 0);
CHECK_TAOS_OPTION_POINTER(pConn, charsetCxt, false);
code = taos_options_connection(pConnUTF8, TSDB_OPTION_CONNECTION_CHARSET, "UTF-8");
ASSERT(code == 0);
CHECK_TAOS_OPTION_POINTER(pConnUTF8, charsetCxt, false);
execQuery(pConn, "drop database if exists db1");
execQuery(pConn, "create database db1");
execQuery(pConn, "create table db1.stb (ts timestamp, c1 nchar(32), c2 int) tags(t1 timestamp, t2 nchar(32), t3 int)");
execQueryFail(pConn, "create table db1.ctb1 using db1.stb tags('2023-09-16 17:00:00+05:00', '芬', 1)");
// 芬 gbk encode is 0xB7D2, the file charset is UTF-8
char sqlTag[256] = {0};
snprintf(sqlTag, sizeof(sqlTag), "create table db1.ctb1 using db1.stb tags('2023-09-16 17:00:00+05:00', '%c%c', 1)", 0xB7, 0xD2);
execQuery(pConn, sqlTag);
// 中国 gbk encode is 0xD6D0B9FA
execQueryFail(pConn, "insert into db1.ctb1 values(1732178775133, '中国', 1)");
char sqlCol[256] = {0};
snprintf(sqlCol, sizeof(sqlCol), "insert into db1.ctb1 values(1732178775133, '%c%c%c%c', 1)", 0xD6, 0xD0, 0xB9, 0xFA);
execQuery(pConn, sqlCol);
char resTag[8] = {0};
snprintf(resTag, sizeof(resTag), "%c%c", 0xB7, 0xD2);
check_sql_result(pConn, "select t2 from db1.ctb1", resTag);
char resCol[8] = {0};
snprintf(resCol, sizeof(resCol), "%c%c%c%c", 0xD6, 0xD0, 0xB9, 0xFA);
check_sql_result(pConn, "select c1 from db1.ctb1", resCol);
check_sql_result(pConnUTF8, "select t2 from db1.ctb1", "");
check_sql_result(pConnUTF8, "select c1 from db1.ctb1", "中国");
execQuery(pConnDefault, "insert into db1.ctb1 values(1732178775134, '中国', 1)");
check_sql_result(pConnDefault, "select c1 from db1.ctb1 where ts = 1732178775134", "中国");
execQuery(pConnUTF8, "create table db1.jsta (ts timestamp, c1 nchar(32), c2 int) tags(t1 json)");
execQuery(pConnUTF8, "create table db1.jsta1 using db1.jsta tags('{\"k\":\"\"}')");
execQuery(pConnUTF8, "insert into db1.jsta1 values(1732178775133, '中国', 1)");
char resJsonTag[32] = {0};
snprintf(resJsonTag, sizeof(resJsonTag), "{\"k\":\"%c%c\"}", 0xB7, 0xD2);
check_sql_result(pConn, "select t1 from db1.jsta1", resJsonTag);
//reset charset to default(utf-8
code = taos_options_connection(pConn, TSDB_OPTION_CONNECTION_CHARSET, NULL);
ASSERT(code == 0);
CHECK_TAOS_OPTION_POINTER(pConn, charsetCxt, true);
check_sql_result(pConn, "select t2 from db1.ctb1 where ts = 1732178775134", "");
check_sql_result(pConn, "select c1 from db1.ctb1 where ts = 1732178775134", "中国");
taos_close(pConn);
taos_close(pConnUTF8);
taos_close(pConnDefault);
}
TEST(charsetCase, alter_charset_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT(pConn != nullptr);
execQueryFail(pConn, "alter dnode 1 'charset gbk'");
execQueryFail(pConn, "local 'charset gbk'");
}
#ifndef WINDOWS
TEST(timezoneCase, set_timezone_Test) {
check_set_timezone(getConnWithGlobalOption);
check_set_timezone(getConnWithOption);
@ -767,6 +854,6 @@ TEST(timezoneCase, localtime_performance_Test) {
printf("average: localtime cost:%" PRId64 " ns, localtime_rz cost:%" PRId64 " ns", time_localtime/times, time_localtime_rz/times);
tzfree(sp);
}
#endif
#pragma GCC diagnostic pop

View File

@ -253,7 +253,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
goto _OVER;
}
tinet_ntoa(ip, pReq->info.conn.clientIp);
taosInetNtoa(ip, pReq->info.conn.clientIp);
if ((code = mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CONNECT)) != 0) {
mGError("user:%s, failed to login from %s since %s", pReq->info.conn.user, ip, tstrerror(code));
goto _OVER;
@ -907,7 +907,7 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
}
char endpoint[TD_IP_LEN + 6 + VARSTR_HEADER_SIZE] = {0};
tinet_ntoa(varDataVal(endpoint), pConn->ip);
taosInetNtoa(varDataVal(endpoint), pConn->ip);
(void)sprintf(varDataVal(endpoint) + strlen(varDataVal(endpoint)), ":%d", pConn->port);
varDataLen(endpoint) = strlen(varDataVal(endpoint));
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
@ -942,7 +942,7 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
char userIp[TD_IP_LEN + 6 + VARSTR_HEADER_SIZE] = {0};
if (pConn->userIp != 0 && pConn->userIp != INADDR_NONE){
tinet_ntoa(varDataVal(userIp), pConn->userIp);
taosInetNtoa(varDataVal(userIp), pConn->userIp);
varDataLen(userIp) = strlen(varDataVal(userIp));
}
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
@ -1039,7 +1039,7 @@ static int32_t packQueriesIntoBlock(SShowObj *pShow, SConnObj *pConn, SSDataBloc
}
char endpoint[TD_IP_LEN + 6 + VARSTR_HEADER_SIZE] = {0};
tinet_ntoa(varDataVal(endpoint), pConn->ip);
taosInetNtoa(varDataVal(endpoint), pConn->ip);
(void)sprintf(varDataVal(endpoint) + strlen(varDataVal(endpoint)), ":%d", pConn->port);
varDataLen(endpoint) = strlen(&endpoint[VARSTR_HEADER_SIZE]);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
@ -1136,7 +1136,7 @@ static int32_t packQueriesIntoBlock(SShowObj *pShow, SConnObj *pConn, SSDataBloc
char userIp[TD_IP_LEN + 6 + VARSTR_HEADER_SIZE] = {0};
if (pConn->userIp != 0 && pConn->userIp != INADDR_NONE){
tinet_ntoa(varDataVal(userIp), pConn->userIp);
taosInetNtoa(varDataVal(userIp), pConn->userIp);
varDataLen(userIp) = strlen(varDataVal(userIp));
}
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
@ -1222,7 +1222,7 @@ static int32_t mndRetrieveApps(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
}
char ip[TD_IP_LEN + VARSTR_HEADER_SIZE] = {0};
tinet_ntoa(varDataVal(ip), pApp->ip);
taosInetNtoa(varDataVal(ip), pApp->ip);
varDataLen(ip) = strlen(varDataVal(ip));
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
code = colDataSetVal(pColInfo, numOfRows, (const char *)ip, false);

View File

@ -691,7 +691,7 @@ static int32_t parseTagToken(const char** end, SToken* pToken, SSchema* pSchema,
return generateSyntaxErrMsg(pMsgBuf, TSDB_CODE_PAR_VALUE_TOO_LONG, pSchema->name);
}
char buf[512] = {0};
snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s", strerror(terrno));
snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s %d %d", strerror(terrno), errno, EILSEQ);
taosMemoryFree(p);
return buildSyntaxErrMsg(pMsgBuf, buf, pToken->z);
}

View File

@ -472,7 +472,8 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi
}
val.type = TSDB_DATA_TYPE_NCHAR;
if (valLen > 0 && !taosMbsToUcs4(jsonValue, valLen, (TdUcs4*)tmp, (int32_t)(valLen * TSDB_NCHAR_SIZE), &valLen, charsetCxt)) {
uError("charset:%s to %s. val:%s, errno:%s, convert failed.", DEFAULT_UNICODE_ENCODEC, tsCharset, jsonValue,
uError("charset:%s to %s. val:%s, errno:%s, convert failed.", DEFAULT_UNICODE_ENCODEC,
charsetCxt != NULL ? ((SConvInfo *)(charsetCxt))->charset : tsCharset, jsonValue,
strerror(terrno));
retCode = buildSyntaxErrMsg(pMsgBuf, "charset convert json error", jsonValue);
taosMemoryFree(tmp);

View File

@ -477,7 +477,8 @@ void parseTagDatatoJson(void* p, char** jsonStr, void *charsetCxt) {
}
int32_t length = taosUcs4ToMbs((TdUcs4*)pTagVal->pData, pTagVal->nData, tagJsonValue, charsetCxt);
if (length < 0) {
qError("charset:%s to %s. val:%s convert json value failed.", DEFAULT_UNICODE_ENCODEC, tsCharset,
qError("charset:%s to %s. val:%s convert json value failed.", DEFAULT_UNICODE_ENCODEC,
charsetCxt != NULL ? ((SConvInfo *)(charsetCxt))->charset : tsCharset,
pTagVal->pData);
taosMemoryFree(tagJsonValue);
goto end;

View File

@ -598,12 +598,13 @@ int32_t ncharTobinary(void *buf, void **out, void* charsetCxt) { // todo need t
*out = taosMemoryCalloc(1, inputLen);
if (NULL == *out) {
sclError("charset:%s to %s. val:%s convert ncharTobinary failed, since memory alloc failed.",
DEFAULT_UNICODE_ENCODEC, tsCharset, (char *)varDataVal(buf));
DEFAULT_UNICODE_ENCODEC, charsetCxt != NULL ? ((SConvInfo *)(charsetCxt))->charset : tsCharset, (char *)varDataVal(buf));
SCL_ERR_RET(terrno);
}
int32_t len = taosUcs4ToMbs((TdUcs4 *)varDataVal(buf), varDataLen(buf), varDataVal(*out), charsetCxt);
if (len < 0) {
sclError("charset:%s to %s. val:%s convert ncharTobinary failed.", DEFAULT_UNICODE_ENCODEC, tsCharset,
sclError("charset:%s to %s. val:%s convert ncharTobinary failed.", DEFAULT_UNICODE_ENCODEC,
charsetCxt != NULL ? ((SConvInfo *)(charsetCxt))->charset : tsCharset,
(char *)varDataVal(buf));
taosMemoryFree(*out);
SCL_ERR_RET(TSDB_CODE_SCALAR_CONVERT_ERROR);

View File

@ -62,7 +62,7 @@ bool syncUtilNodeInfo2RaftId(const SNodeInfo* pInfo, SyncGroupId vgId, SRaftId*
}
char ipbuf[TD_IP_LEN] = {0};
tinet_ntoa(ipbuf, ipv4);
taosInetNtoa(ipbuf, ipv4);
raftId->addr = SYNC_ADDR(pInfo);
raftId->vgId = vgId;

View File

@ -520,7 +520,7 @@ void syncUtilU642Addr(uint64_t u64, char *host, int64_t len, uint16_t *port) {
uint32_t hostU32 = (uint32_t)((u64 >> 32) & 0x00000000FFFFFFFF);
struct in_addr addr = {.s_addr = hostU32};
taosInetNtoa(addr, host, len);
taosInetNtop(addr, host, len);
*port = (uint16_t)((u64 & 0x00000000FFFF0000) >> 16);
}

View File

@ -224,7 +224,7 @@ static FORCE_INLINE int32_t taosBuildDstAddr(const char* server, uint16_t port,
return TSDB_CODE_RPC_FQDN_ERROR;
}
char buf[TD_IP_LEN] = {0};
tinet_ntoa(buf, ip);
taosInetNtoa(buf, ip);
int ret = uv_ip4_addr(buf, port, dest);
if (ret != 0) {
tError("http-report failed to get addr, reason:%s", uv_err_name(ret));

View File

@ -1856,8 +1856,8 @@ static FORCE_INLINE int32_t cliUpdateFqdnCache(SHashObj* cache, char* fqdn) {
if (v != NULL) {
if (addr != *v) {
char old[TSDB_FQDN_LEN] = {0}, new[TSDB_FQDN_LEN] = {0};
tinet_ntoa(old, *v);
tinet_ntoa(new, addr);
taosInetNtoa(old, *v);
taosInetNtoa(new, addr);
tWarn("update ip of fqdn:%s, old: %s, new: %s", fqdn, old, new);
code = taosHashPut(cache, fqdn, len, &addr, sizeof(addr));
}

View File

@ -150,7 +150,7 @@ int32_t taosSetSockOpt(TdSocketPtr pSocket, int32_t level, int32_t optname, void
#endif
}
const char *taosInetNtoa(struct in_addr ipInt, char *dstStr, int32_t len) {
const char *taosInetNtop(struct in_addr ipInt, char *dstStr, int32_t len) {
const char *r = inet_ntop(AF_INET, &ipInt, dstStr, len);
if (NULL == r) {
terrno = TAOS_SYSTEM_ERROR(errno);
@ -386,7 +386,7 @@ int32_t taosGetFqdn(char *fqdn) {
return 0;
}
void tinet_ntoa(char *ipstr, uint32_t ip) {
void taosInetNtoa(char *ipstr, uint32_t ip) {
if (ipstr == NULL) {
return;
}
@ -394,6 +394,13 @@ void tinet_ntoa(char *ipstr, uint32_t ip) {
(void)snprintf(ipstr, TD_IP_LEN, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]);
}
uint32_t taosInetAddr(const char *ipstr){
if (ipstr == NULL) {
return 0;
}
return inet_addr(ipstr);
}
int32_t taosIgnSIGPIPE() {
sighandler_t h = signal(SIGPIPE, SIG_IGN);
if (SIG_ERR == h) {

View File

@ -326,6 +326,8 @@ bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4
size_t ucs4_input_len = mbsLength;
size_t outLeft = ucs4_max_len;
if (iconv(conv, (char **)&mbs, &ucs4_input_len, (char **)&ucs4, &outLeft) == -1) {
char buf[512] = {0};
snprintf(buf, tListLen(buf), " taosMbsToUcs4 error:%s %d %d", strerror(terrno), errno, EILSEQ);
terrno = TAOS_SYSTEM_ERROR(errno);
taosReleaseConv(idx, conv, M2C, charsetCxt);
return false;

View File

@ -188,10 +188,20 @@ class TDTestCase:
for i in range(rows):
if tdSql.getData(i, 0) == "timezone" :
if tdSql.getData(i, 1).find(timezone) == -1:
tdLog.exit("show timezone:%s != %s"%(tdSql.getData(i, 1),timezone))
tdLog.exit("show timezone:%s != %s"%(tdSql.getData(i, 1), timezone))
def charset_check(self, sql, charset):
tdSql.query(sql)
rows = tdSql.getRows()
for i in range(rows):
if tdSql.getData(i, 0) == "charset" :
if tdSql.getData(i, 1).find(charset) == -1:
tdLog.exit("show charset:%s != %s"%(tdSql.getData(i, 1), charset))
def run(self): # sourcery skip: extract-duplicate-method
timezone = self.get_system_timezone()
# timezone = "Asia/Shanghai"
self.charset_check("show local variables", "UTF-8")
self.timezone_check("show dnode 1 variables", "UTF-8")
self.timezone_check("show local variables", timezone)
self.timezone_check("show dnode 1 variables", timezone)

View File

@ -6,23 +6,33 @@ from util.sqlset import *
from util.cluster import *
class TDTestCase:
updateCfgDict = {"clientCfg" : {'timezone': 'UTC'} , 'timezone': 'UTC-8'}
updatecfgDict = {"clientCfg" : {'timezone': 'UTC', 'charset': 'gbk'}, 'timezone': 'UTC-8', 'charset': 'gbk'}
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor())
def timezone_check(self, timezone, sql):
tdSql.execute(sql)
tdSql.query(sql)
rows = tdSql.getRows()
for i in range(rows):
if tdSql.getData(i, 0) == "timezone" :
if tdSql.getData(i, 1).find(timezone) == -1:
tdLog.exit("show timezone:%s != %s"%(tdSql.getData(i, 1),timezone))
tdLog.exit("show timezone:%s != %s"%(tdSql.getData(i, 1), timezone))
def charset_check(self, charset, sql):
tdSql.query(sql)
rows = tdSql.getRows()
for i in range(rows):
if tdSql.getData(i, 0) == "charset" :
if tdSql.getData(i, 1).find(charset) == -1:
tdLog.exit("show charset:%s != %s"%(tdSql.getData(i, 1), charset))
def run(self):
self.charset_check('gbk', "show local variables")
self.charset_check('gbk', "show dnode 1 variables")
self.timezone_check('UTC', "show local variables")
# time.sleep(50)
self.timezone_check('UTC-8', "show dnode 1 variables")
def stop(self):