fix:unit test
This commit is contained in:
parent
9b6a094cac
commit
e2bbb11e72
|
@ -1523,29 +1523,29 @@ TEST(clientCase, timezone_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);
|
||||||
|
|
||||||
TAOS_RES* pRes = taos_query(pConn, "drop database if exists db1");
|
TAOS_RES* pRes = taos_query(pConn, "drop database if exists db_timezone");
|
||||||
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
pRes = taos_query(pConn, "create database db1");
|
pRes = taos_query(pConn, "create database db_timezone");
|
||||||
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
pRes = taos_query(pConn, "create table db1.t1 (ts timestamp, v int)");
|
pRes = taos_query(pConn, "create table db_timezone.t1 (ts timestamp, v int)");
|
||||||
while (taos_errno(pRes) == TSDB_CODE_MND_DB_IN_CREATING || taos_errno(pRes) == TSDB_CODE_MND_DB_IN_DROPPING) {
|
while (taos_errno(pRes) == TSDB_CODE_MND_DB_IN_CREATING || taos_errno(pRes) == TSDB_CODE_MND_DB_IN_DROPPING) {
|
||||||
taosMsleep(2000);
|
taosMsleep(2000);
|
||||||
pRes = taos_query(pConn, "create table db1.t1 (ts timestamp, v int)");
|
pRes = taos_query(pConn, "create table db_timezone.t1 (ts timestamp, v int)");
|
||||||
}
|
}
|
||||||
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
char sql[256] = {0};
|
char sql[256] = {0};
|
||||||
(void)sprintf(sql, "insert into db1.t1 values('2023-09-16 17:00:00', 1)");
|
(void)sprintf(sql, "insert into db_timezone.t1 values('2023-09-16 17:00:00', 1)");
|
||||||
pRes = taos_query(pConn, sql);
|
pRes = taos_query(pConn, sql);
|
||||||
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
pRes = taos_query(pConn, "select * from db1.t1 where ts == '2023-09-16 17:00:00'");
|
pRes = taos_query(pConn, "select * from db_timezone.t1 where ts == '2023-09-16 17:00:00'");
|
||||||
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
||||||
|
|
||||||
TAOS_ROW pRow = NULL;
|
TAOS_ROW pRow = NULL;
|
||||||
|
@ -1571,7 +1571,7 @@ TEST(clientCase, timezone_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);
|
||||||
|
|
||||||
TAOS_RES* pRes = taos_query(pConn, "select * from db1.t1 where ts == '2023-09-16 01:00:00'");
|
TAOS_RES* pRes = taos_query(pConn, "select * from db_timezone.t1 where ts == '2023-09-16 01:00:00'");
|
||||||
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
||||||
|
|
||||||
TAOS_ROW pRow = NULL;
|
TAOS_ROW pRow = NULL;
|
||||||
|
@ -1588,7 +1588,7 @@ TEST(clientCase, timezone_Test) {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
char sql[256] = {0};
|
char sql[256] = {0};
|
||||||
(void)sprintf(sql, "insert into db1.t1 values('2023-09-16 17:00:01', 1)");
|
(void)sprintf(sql, "insert into db_timezone.t1 values('2023-09-16 17:00:01', 1)");
|
||||||
pRes = taos_query(pConn, sql);
|
pRes = taos_query(pConn, sql);
|
||||||
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
||||||
|
|
||||||
|
@ -1604,7 +1604,7 @@ TEST(clientCase, timezone_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);
|
||||||
|
|
||||||
TAOS_RES* pRes = taos_query(pConn, "select * from db1.t1 where ts == '2023-09-16 09:00:00'");
|
TAOS_RES* pRes = taos_query(pConn, "select * from db_timezone.t1 where ts == '2023-09-16 09:00:00'");
|
||||||
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
||||||
|
|
||||||
TAOS_ROW pRow = NULL;
|
TAOS_ROW pRow = NULL;
|
||||||
|
@ -1620,7 +1620,7 @@ TEST(clientCase, timezone_Test) {
|
||||||
taos_free_result(pRes);
|
taos_free_result(pRes);
|
||||||
|
|
||||||
{
|
{
|
||||||
TAOS_RES* pRes = taos_query(pConn, "select * from db1.t1 where ts == '2023-09-17 01:00:01'");
|
TAOS_RES* pRes = taos_query(pConn, "select * from db_timezone.t1 where ts == '2023-09-17 01:00:01'");
|
||||||
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(taos_errno(pRes), TSDB_CODE_SUCCESS);
|
||||||
|
|
||||||
TAOS_ROW pRow = NULL;
|
TAOS_ROW pRow = NULL;
|
||||||
|
|
Loading…
Reference in New Issue