test case

This commit is contained in:
xsren 2024-08-08 19:40:38 +08:00
parent ecb757326f
commit 2c68cffe6e
5 changed files with 122 additions and 183 deletions

View File

@ -35,6 +35,11 @@ TARGET_INCLUDE_DIRECTORIES(
PRIVATE "${TD_SOURCE_DIR}/source/client/inc" PRIVATE "${TD_SOURCE_DIR}/source/client/inc"
) )
add_test(
NAME clientTest
COMMAND clientTest
)
TARGET_INCLUDE_DIRECTORIES( TARGET_INCLUDE_DIRECTORIES(
tmqTest tmqTest
PUBLIC "${TD_SOURCE_DIR}/include/client/" PUBLIC "${TD_SOURCE_DIR}/include/client/"

View File

@ -16,6 +16,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <iostream> #include <iostream>
#include "clientInt.h" #include "clientInt.h"
#include "osSemaphore.h"
#include "taoserror.h" #include "taoserror.h"
#include "tglobal.h" #include "tglobal.h"
#include "thash.h" #include "thash.h"
@ -126,6 +127,9 @@ void queryCallback(void* param, void* res, int32_t code) {
} }
(void)printf("start to fetch data\n"); (void)printf("start to fetch data\n");
taos_fetch_raw_block_a(res, fetchCallback, param); taos_fetch_raw_block_a(res, fetchCallback, param);
taos_free_result(res);
tsem_t *sem = (tsem_t *)param;
tsem_post(sem);
} }
void createNewTable(TAOS* pConn, int32_t index, int32_t numOfRows, int64_t startTs, const char* pVarchar) { void createNewTable(TAOS* pConn, int32_t index, int32_t numOfRows, int64_t startTs, const char* pVarchar) {
@ -189,7 +193,7 @@ void* queryThread(void* arg) {
int64_t el = 0; int64_t el = 0;
for (int32_t i = 0; i < 5000000; ++i) { for (int32_t i = 0; i < 5; ++i) {
int64_t st = taosGetTimestampUs(); int64_t st = taosGetTimestampUs();
TAOS_RES* pRes = taos_query(pConn, TAOS_RES* pRes = taos_query(pConn,
"SELECT _wstart as ts,max(usage_user) FROM benchmarkcpu.host_49 WHERE ts >= " "SELECT _wstart as ts,max(usage_user) FROM benchmarkcpu.host_49 WHERE ts >= "
@ -320,6 +324,13 @@ TEST(clientCase, connect_Test) {
if (pConn == NULL) { if (pConn == NULL) {
(void)printf("failed to connect to server, reason:%s\n", taos_errstr(NULL)); (void)printf("failed to connect to server, reason:%s\n", taos_errstr(NULL));
} }
TAOS_RES* pRes = taos_query(pConn, "drop database abc1");
if (taos_errno(pRes) != 0) {
(void)printf("error in drop db, reason:%s\n", taos_errstr(pRes));
}
taos_free_result(pRes);
taos_close(pConn); taos_close(pConn);
} }
@ -412,7 +423,7 @@ TEST(clientCase, show_db_Test) {
int32_t code = taos_print_row(str, pRow, pFields, numOfFields); int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
(void)printf("%s\n", str); (void)printf("%s\n", str);
} }
taos_free_result(pRes);
taos_close(pConn); taos_close(pConn);
} }
@ -437,6 +448,7 @@ TEST(clientCase, create_db_Test) {
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
(void)printf("error in create db, reason:%s\n", taos_errstr(pRes)); (void)printf("error in create db, reason:%s\n", taos_errstr(pRes));
} }
taos_free_result(pRes);
taos_close(pConn); taos_close(pConn);
} }
@ -473,6 +485,7 @@ TEST(clientCase, drop_dnode_Test) {
int32_t numOfFields = taos_num_fields(pRes); int32_t numOfFields = taos_num_fields(pRes);
ASSERT_EQ(numOfFields, 0); ASSERT_EQ(numOfFields, 0);
taos_free_result(pRes);
pRes = taos_query(pConn, "drop dnode 4"); pRes = taos_query(pConn, "drop dnode 4");
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
@ -498,31 +511,10 @@ TEST(clientCase, use_db_test) {
int32_t numOfFields = taos_num_fields(pRes); int32_t numOfFields = taos_num_fields(pRes);
ASSERT_EQ(numOfFields, 0); ASSERT_EQ(numOfFields, 0);
taos_free_result(pRes);
taos_close(pConn); taos_close(pConn);
} }
// TEST(clientCase, drop_db_test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
//
// showDB(pConn);
//
// TAOS_RES* pRes = taos_query(pConn, "drop database abc1");
// if (taos_errno(pRes) != 0) {
// (void)printf("failed to drop db, reason:%s\n", taos_errstr(pRes));
// }
// taos_free_result(pRes);
//
// showDB(pConn);
//
// pRes = taos_query(pConn, "create database abc1");
// if (taos_errno(pRes) != 0) {
// (void)printf("create to drop db, reason:%s\n", taos_errstr(pRes));
// }
// taos_free_result(pRes);
// taos_close(pConn);
//}
TEST(clientCase, create_stable_Test) { TEST(clientCase, create_stable_Test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
assert(pConn != NULL); assert(pConn != NULL);
@ -534,6 +526,7 @@ TEST(clientCase, create_stable_Test) {
taos_free_result(pRes); taos_free_result(pRes);
pRes = taos_query(pConn, "use abc1"); pRes = taos_query(pConn, "use abc1");
taos_free_result(pRes);
pRes = taos_query(pConn, "create table if not exists abc1.st1(ts timestamp, k int) tags(a int)"); pRes = taos_query(pConn, "create table if not exists abc1.st1(ts timestamp, k int) tags(a int)");
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
@ -547,18 +540,6 @@ TEST(clientCase, create_stable_Test) {
ASSERT_EQ(numOfFields, 0); ASSERT_EQ(numOfFields, 0);
taos_free_result(pRes); taos_free_result(pRes);
// pRes = taos_query(pConn, "create stable if not exists abc1.`123_$^)` (ts timestamp, `abc` int) tags(a int)");
// if (taos_errno(pRes) != 0) {
// (void)printf("failed to create super table 123_$^), reason:%s\n", taos_errstr(pRes));
// }
//
// pRes = taos_query(pConn, "use abc1");
// taos_free_result(pRes);
// pRes = taos_query(pConn, "drop stable `123_$^)`");
// if (taos_errno(pRes) != 0) {
// (void)printf("failed to drop super table 123_$^), reason:%s\n", taos_errstr(pRes));
// }
taos_close(pConn); taos_close(pConn);
} }
@ -743,7 +724,8 @@ TEST(clientCase, show_table_Test) {
} }
taos_free_result(pRes); taos_free_result(pRes);
(void)taos_query(pConn, "use abc1"); pRes = taos_query(pConn, "use abc1");
taos_free_result(pRes);
pRes = taos_query(pConn, "show tables"); pRes = taos_query(pConn, "show tables");
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
@ -760,38 +742,15 @@ TEST(clientCase, show_table_Test) {
while ((pRow = taos_fetch_row(pRes)) != NULL) { while ((pRow = taos_fetch_row(pRes)) != NULL) {
int32_t code = taos_print_row(str, pRow, pFields, numOfFields); int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
if(code > 0) {
(void)printf("%d: %s\n", ++count, str); (void)printf("%d: %s\n", ++count, str);
} }
}
taos_free_result(pRes); taos_free_result(pRes);
taos_close(pConn); taos_close(pConn);
} }
// TEST(clientCase, drop_stable_Test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != nullptr);
//
// TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1");
// if (taos_errno(pRes) != 0) {
// (void)printf("error in creating db, reason:%s\n", taos_errstr(pRes));
// }
// taos_free_result(pRes);
//
// pRes = taos_query(pConn, "use abc1");
// if (taos_errno(pRes) != 0) {
// (void)printf("error in using db, reason:%s\n", taos_errstr(pRes));
// }
// taos_free_result(pRes);
//
// pRes = taos_query(pConn, "drop stable st1");
// if (taos_errno(pRes) != 0) {
// (void)printf("failed to drop stable, reason:%s\n", taos_errstr(pRes));
// }
//
// taos_free_result(pRes);
// taos_close(pConn);
// }
TEST(clientCase, generated_request_id_test) { TEST(clientCase, generated_request_id_test) {
SHashObj* phash = taosHashInit(10000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK); SHashObj* phash = taosHashInit(10000, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
@ -832,11 +791,6 @@ TEST(clientCase, projection_query_tables) {
TAOS_RES* pRes = NULL; TAOS_RES* pRes = NULL;
// TAOS_RES* pRes = taos_query(pConn, "create database if not exists abc1 vgroups 1");
// if (taos_errno(pRes) != 0) {
// (void)printf("error in create db, reason:%s\n", taos_errstr(pRes));
// }
// taos_free_result(pRes);
pRes= taos_query(pConn, "use abc1"); pRes= taos_query(pConn, "use abc1");
taos_free_result(pRes); taos_free_result(pRes);
@ -846,6 +800,12 @@ TEST(clientCase, projection_query_tables) {
} }
taos_free_result(pRes); taos_free_result(pRes);
pRes = taos_query(pConn, "create table st2 (ts timestamp, v1 int) tags(t1 int)");
if (taos_errno(pRes) != 0) {
(void)printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
}
taos_free_result(pRes);
int64_t start = 1685959190000; int64_t start = 1685959190000;
const char* pstr = const char* pstr =
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh" "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh"
@ -861,7 +821,7 @@ TEST(clientCase, projection_query_tables) {
TAOS_RES* px = taos_query(pConn, str); TAOS_RES* px = taos_query(pConn, str);
if (taos_errno(px) != 0) { if (taos_errno(px) != 0) {
(void)printf("failed to create table tu, reason:%s\n", taos_errstr(pRes)); (void)printf("failed to create table tu, reason:%s\n", taos_errstr(px));
} }
taos_free_result(px); taos_free_result(px);
} }
@ -869,7 +829,7 @@ TEST(clientCase, projection_query_tables) {
for(int32_t j = 0; j < 1; ++j) { for(int32_t j = 0; j < 1; ++j) {
start += 20; start += 20;
for (int32_t i = 0; i < 1; ++i) { for (int32_t i = 0; i < 1; ++i) {
createNewTable(pConn, i, 100000, 0, pstr); createNewTable(pConn, i, 10000, 0, pstr);
} }
} }
@ -900,7 +860,9 @@ TEST(clientCase, tsbs_perf_test) {
for (int32_t i = 0; i < numOfThreads; ++i) { for (int32_t i = 0; i < numOfThreads; ++i) {
(void)taosThreadCreate(&qid[i], NULL, queryThread, NULL); (void)taosThreadCreate(&qid[i], NULL, queryThread, NULL);
} }
getchar(); for (int32_t i = 0; i < numOfThreads; ++i) {
(void)taosThreadJoin(qid[i], NULL);
}
} }
TEST(clientCase, projection_query_stables) { TEST(clientCase, projection_query_stables) {
@ -908,14 +870,6 @@ TEST(clientCase, projection_query_stables) {
ASSERT_NE(pConn, nullptr); ASSERT_NE(pConn, nullptr);
TAOS_RES* pRes = taos_query(pConn, "explain select * from dbvg.st where tbname='ct1'"); TAOS_RES* pRes = taos_query(pConn, "explain select * from dbvg.st where tbname='ct1'");
// taos_free_result(pRes);
// pRes = taos_query(pConn, "select * from st2");
// if (taos_errno(pRes) != 0) {
// (void)printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
// taos_free_result(pRes);
// ASSERT_TRUE(false);
// }
TAOS_ROW pRow = NULL; TAOS_ROW pRow = NULL;
TAOS_FIELD* pFields = taos_fetch_fields(pRes); TAOS_FIELD* pFields = taos_fetch_fields(pRes);
@ -939,12 +893,6 @@ TEST(clientCase, projection_query_stables) {
} }
//(void)printf("%d\n", i); //(void)printf("%d\n", i);
} }
// while ((pRow = taos_fetch_row(pRes)) != NULL) {
// int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
// if (i++ % 100000 == 0) {
// (void)printf("%d\n", i);
// }
// }
taos_free_result(pRes); taos_free_result(pRes);
taos_close(pConn); taos_close(pConn);
@ -971,55 +919,41 @@ TEST(clientCase, agg_query_tables) {
pRes = taos_query(pConn, s); pRes = taos_query(pConn, s);
int32_t ret = taos_errno(pRes); int32_t ret = taos_errno(pRes);
if (ret != 0) {
(void)printf("failed to insert into table, reason:%s\n", taos_errstr(pRes));
}
taos_free_result(pRes); taos_free_result(pRes);
if (ret == 0) {
break; break;
} }
} }
// while (1) {
// sprintf(s, "insert into t2 values(%ld, %d)", st + i, i);
// pRes = taos_query(pConn, s);
// int32_t ret = taos_errno(pRes);
//
// taos_free_result(pRes);
// if (ret == 0) {
// break;
// }
// }
}
// pRes = taos_query(pConn, "show table distributed tup");
// if (taos_errno(pRes) != 0) {
// (void)printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
// taos_free_result(pRes);
// ASSERT_TRUE(false);
// }
printResult(pRes);
taos_free_result(pRes);
taos_close(pConn); taos_close(pConn);
} }
/* // --- copy the following script in the shell to setup the environment ---
--- copy the following script in the shell to setup the environment --- //
// create database test;
// use test;
// create table m1(ts timestamp, k int) tags(a int);
// create table tm0 using m1 tags(1);
// create table tm1 using m1 tags(2);
// insert into tm0 values('2021-1-1 1:1:1.120', 1) ('2021-1-1 1:1:2.9', 2) tm1 values('2021-1-1 1:1:1.120', 11) ('2021-1-1
// 1:1:2.99', 22);
create database test;
use test;
create table m1(ts timestamp, k int) tags(a int);
create table tm0 using m1 tags(1);
create table tm1 using m1 tags(2);
insert into tm0 values('2021-1-1 1:1:1.120', 1) ('2021-1-1 1:1:2.9', 2) tm1 values('2021-1-1 1:1:1.120', 11) ('2021-1-1
1:1:2.99', 22);
*/
TEST(clientCase, async_api_test) { TEST(clientCase, async_api_test) {
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
ASSERT_NE(pConn, nullptr); ASSERT_NE(pConn, nullptr);
(void)taos_query(pConn, "use abc1"); TAOS_RES* pRes = taos_query(pConn, "use abc1");
if (taos_errno(pRes) != 0) {
(void)printf("failed to use db, reason:%s\n", taos_errstr(pRes));
taos_free_result(pRes);
taos_close(pConn);
return;
}
taos_free_result(pRes);
TAOS_RES* pRes = taos_query(pConn, "insert into tu(ts) values('2022-02-27 12:12:61')"); pRes = taos_query(pConn, "insert into tu(ts) values('2022-02-27 12:12:61')");
if (taos_errno(pRes) != 0) { if (taos_errno(pRes) != 0) {
(void)printf("failed, reason:%s\n", taos_errstr(pRes)); (void)printf("failed, reason:%s\n", taos_errstr(pRes));
} }
@ -1041,9 +975,12 @@ TEST(clientCase, async_api_test) {
(void)printf("%s\n", str); (void)printf("%s\n", str);
(void)memset(str, 0, sizeof(str)); (void)memset(str, 0, sizeof(str));
} }
taos_free_result(pRes);
taos_query_a(pConn, "select count(*) from tu", queryCallback, pConn); tsem_t sem;
(void)getchar(); (void)tsem_init(&sem, 0, 0);
taos_query_a(pConn, "select count(*) from tu", queryCallback, &sem);
tsem_wait(&sem);
tsem_destroy(&sem);
taos_close(pConn); taos_close(pConn);
} }
@ -1055,6 +992,7 @@ TEST(clientCase, update_test) {
if (taos_errno(pRes) != TSDB_CODE_SUCCESS) { if (taos_errno(pRes) != TSDB_CODE_SUCCESS) {
(void)printf("failed to create database, code:%s", taos_errstr(pRes)); (void)printf("failed to create database, code:%s", taos_errstr(pRes));
taos_free_result(pRes); taos_free_result(pRes);
taos_close(pConn);
return; return;
} }
@ -1064,6 +1002,7 @@ TEST(clientCase, update_test) {
if (taos_errno(pRes) != TSDB_CODE_SUCCESS) { if (taos_errno(pRes) != TSDB_CODE_SUCCESS) {
(void)printf("failed to use db, code:%s", taos_errstr(pRes)); (void)printf("failed to use db, code:%s", taos_errstr(pRes));
taos_free_result(pRes); taos_free_result(pRes);
taos_close(pConn);
return; return;
} }
taos_free_result(pRes); taos_free_result(pRes);
@ -1076,11 +1015,12 @@ TEST(clientCase, update_test) {
taos_free_result(pRes); taos_free_result(pRes);
char s[256] = {0}; char s[256] = {0};
for (int32_t i = 0; i < 17000; ++i) { for (int32_t i = 0; i < 10; ++i) {
(void)sprintf(s, "insert into tup values(now+%da, %d)", i, i); (void)sprintf(s, "insert into tup values(now+%da, %d)", i, i);
pRes = taos_query(pConn, s); pRes = taos_query(pConn, s);
taos_free_result(pRes); taos_free_result(pRes);
} }
taos_close(pConn);
} }
TEST(clientCase, sub_db_test) { TEST(clientCase, sub_db_test) {
@ -1158,10 +1098,13 @@ TEST(clientCase, sub_db_test) {
(void)printf("precision: %d, row content: %s\n", precision, buf); (void)printf("precision: %d, row content: %s\n", precision, buf);
} }
taos_free_result(pRes); taos_free_result(pRes);
} else {
break;
} }
} }
(void)fprintf(stderr, "%d msg consumed, include %d rows\n", msgCnt, totalRows); (void)fprintf(stderr, "%d msg consumed, include %d rows\n", msgCnt, totalRows);
taos_close(pConn);
} }
TEST(clientCase, tmq_commit) { TEST(clientCase, tmq_commit) {
@ -1550,38 +1493,4 @@ TEST(clientCase, sub_tb_mt_test) {
} }
} }
//static void concatStrings(SArray *list, char* buf, int size){
// int len = 0;
// for(int i = 0; i < taosArrayGetSize(list); i++){
// char* db = (char*)taosArrayGet(list, i);
// char* dot = strchr(db, '.');
// if (dot != NULL) {
// db = dot + 1;
// }
// if (i != 0){
// strcat(buf, ",");
// len += 1;
// }
// int ret = snprintf(buf + len, size - len, "%s", db);
// if (ret < 0) {
// (void)printf("snprintf failed, buf:%s, ret:%d", buf, ret);
// break;
// }
// len += ret;
// if (len >= size){
// (void)printf("dbList is truncated, buf:%s, len:%d", buf, len);
// break;
// }
// }
//}
//
//TEST(clientCase, concat_string_test) {
// SArray* list = taosArrayInit(10, TSDB_DB_FNAME_LEN);
// taosArrayPush(list, "1.db1");
// taosArrayPush(list, "2.db2");
//
// char buf[32] = {0};
// concatStrings(list, buf, sizeof(buf) - 1);
//}
#pragma GCC diagnostic pop #pragma GCC diagnostic pop

View File

@ -524,16 +524,16 @@ class TDCom:
# print(con) # print(con)
return con return con
def newcur(self,host='localhost',port=6030,user='root',password='taosdata'): def newcur(self,host='localhost',port=6030,user='root',password='taosdata', timezone='asia/shanghai'):
cfgPath = self.getClientCfgPath() cfgPath = self.getClientCfgPath()
con=taos.connect(host=host, user=user, password=password, config=cfgPath, port=port) con=taos.connect(host=host, user=user, password=password, config=cfgPath, port=port, timezone=timezone)
cur=con.cursor() cur=con.cursor()
# print(cur) # print(cur)
return cur return cur
def newTdSql(self, host='localhost',port=6030,user='root',password='taosdata'): def newTdSql(self, host='localhost',port=6030,user='root',password='taosdata', timezone='asia/shanghai'):
newTdSql = TDSql() newTdSql = TDSql()
cur = self.newcur(host=host,port=port,user=user,password=password) cur = self.newcur(host=host,port=port,user=user,password=password, timezone=timezone)
newTdSql.init(cur, False) newTdSql.init(cur, False)
return newTdSql return newTdSql

View File

@ -543,16 +543,16 @@ class TDCom:
# print(con) # print(con)
return con return con
def newcur(self,host='localhost',port=6030,user='root',password='taosdata',database=None): def newcur(self,host='localhost',port=6030,user='root',password='taosdata',database=None, timezone='asia/shanghai'):
cfgPath = self.getClientCfgPath() cfgPath = self.getClientCfgPath()
con=taos.connect(host=host, user=user, password=password, config=cfgPath, port=port,database=database) con=taos.connect(host=host, user=user, password=password, config=cfgPath, port=port,database=database, timezone=timezone)
cur=con.cursor() cur=con.cursor()
# print(cur) # print(cur)
return cur return cur
def newTdSql(self, host='localhost',port=6030,user='root',password='taosdata', database = None): def newTdSql(self, host='localhost',port=6030,user='root',password='taosdata', database = None, timezone='asia/shanghai'):
newTdSql = TDSql() newTdSql = TDSql()
cur = self.newcur(host=host,port=port,user=user,password=password, database=database) cur = self.newcur(host=host,port=port,user=user,password=password, database=database, timezone=timezone)
newTdSql.init(cur, False) newTdSql.init(cur, False)
return newTdSql return newTdSql

View File

@ -2,6 +2,7 @@ from wsgiref.headers import tspecials
from util.log import * from util.log import *
from util.cases import * from util.cases import *
from util.sql import * from util.sql import *
from util.common import tdCom
import numpy as np import numpy as np
@ -127,11 +128,35 @@ class TDTestCase:
tdSql.query(f"select * from {dbname}.stb where loc not in ('shanghai', 'shanghai', null)") tdSql.query(f"select * from {dbname}.stb where loc not in ('shanghai', 'shanghai', null)")
tdSql.checkRows(0) tdSql.checkRows(0)
def timeZoneTest(self):
dbname = self.dbname
tdSql.execute(f'create table {dbname}.tzt(ts timestamp, c1 int)')
tdSql.execute(f'insert into {dbname}.tzt values({self.ts}, 1)')
tdSql.query(f"select * from {dbname}.tzt")
tdSql.checkRows(1)
tdSql.checkData(0, 0, "2018-09-17 09:00:00")
tdsql1 = tdCom.newTdSql(timezone="UTC")
tdsql1.query(f"select * from {dbname}.tzt")
tdsql1.checkRows(1)
tdsql1.checkData(0, 0, "2018-09-17 01:00:00")
tdsql1.execute(f'insert into {dbname}.tzt values({self.ts + 1000}, 2)')
tdsql1.query(f"select * from {dbname}.tzt order by ts")
tdsql1.checkRows(2)
tdsql1.checkData(1, 0, "2018-09-17 01:00:01")
tdsql2 = tdCom.newTdSql(timezone="Asia/Shanghai")
tdsql2.query(f"select * from {dbname}.tzt order by ts")
tdsql2.checkRows(2)
tdsql2.checkData(1, 0, "2018-09-17 09:00:01")
def run(self): def run(self):
dbname = "db" dbname = "db"
tdSql.prepare() tdSql.prepare()
self.timeZoneTest()
self.inAndNotinTest() self.inAndNotinTest()