From 0c9964d30bc280ea755664af138d70c9a91e3853 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 14 Sep 2022 17:38:42 +0800 Subject: [PATCH] test(query): update the unit test. --- source/client/CMakeLists.txt | 4 ++-- source/client/src/clientImpl.c | 2 +- source/client/test/clientTests.cpp | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index e8e3c87849..045cb4e01f 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -53,6 +53,6 @@ target_link_libraries( PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom ) -if(${BUILD_TEST}) +#if(${BUILD_TEST}) ADD_SUBDIRECTORY(test) -endif(${BUILD_TEST}) \ No newline at end of file +#endif(${BUILD_TEST}) \ No newline at end of file diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 18c7367ba1..7ff4ca9ff7 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1036,7 +1036,7 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaData* pResultM pRequest->metric.planEnd = taosGetTimestampUs(); if (code == TSDB_CODE_SUCCESS) { - tscDebug("0x%" PRIx64 " create query plan success, elapsed time:%.2f ms, %0x" PRIx64, pRequest->self, + tscDebug("0x%" PRIx64 " create query plan success, elapsed time:%.2f ms, 0x%" PRIx64, pRequest->self, (pRequest->metric.planEnd - st)/1000.0, pRequest->requestId); } diff --git a/source/client/test/clientTests.cpp b/source/client/test/clientTests.cpp index 8e9eeb875b..cbf804ee03 100644 --- a/source/client/test/clientTests.cpp +++ b/source/client/test/clientTests.cpp @@ -676,13 +676,14 @@ TEST(testCase, projection_query_tables) { // } // taos_free_result(pRes); - TAOS_RES* pRes = taos_query(pConn, "use abc1"); + TAOS_RES* pRes = taos_query(pConn, "use benchmarkcpu"); taos_free_result(pRes); pRes = taos_query(pConn, "create stable st1 (ts timestamp, k int) tags(a int)"); if (taos_errno(pRes) != 0) { printf("failed to create table tu, reason:%s\n", taos_errstr(pRes)); } + taos_free_result(pRes); pRes = taos_query(pConn, "create stable st2 (ts timestamp, k int) tags(a int)"); @@ -697,11 +698,17 @@ TEST(testCase, projection_query_tables) { } taos_free_result(pRes); - for(int32_t i = 0; i < 2; ++i) { - printf("create table :%d\n", i); - createNewTable(pConn, i); + for (int32_t i = 0; i < 500; ++i) { + pRes = taos_query(pConn, + "SELECT max(usage_user), max(usage_system), max(usage_idle), max(usage_nice), max(usage_iowait), " + "max(usage_irq), max(usage_softirq), max(usage_steal), max(usage_guest), " + "max(usage_guest_nice) FROM cpu WHERE hostname IN ('host_249') AND ts >= 1451648911646 AND ts < " + "1451677711646;"); + taos_free_result(pRes); + // printf("create table :%d\n", i); + // createNewTable(pConn, i); } -// + // // pRes = taos_query(pConn, "select * from tu"); // if (taos_errno(pRes) != 0) { // printf("failed to select from table, reason:%s\n", taos_errstr(pRes)); -- GitLab