diff --git a/CMakeLists.txt b/CMakeLists.txt index c29eab9..7a51447 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ INCLUDE (openssl) INCLUDE (version) OPTION (BUILD_BENCHMARK "Build benchmark" OFF) -OPTION (BUILD_TESTS "Build tests" OFF) +OPTION (BUILD_TESTS "Build tests" ON) OPTION (BUILD_EXAMPLES "Build examples" ON) OPTION (BUILD_SHARED_LIBS "Build shared libs" OFF) OPTION (WITH_OPENSSL "Use OpenSSL for TLS connections" OFF) @@ -18,7 +18,7 @@ OPTION (WITH_SYSTEM_CITYHASH "Use system cityhash" OFF) OPTION (WITH_SYSTEM_ZSTD "Use system ZSTD" OFF) OPTION (DEBUG_DEPENDENCIES "Print debug info about dependencies duting build" ON) OPTION (CHECK_VERSION "Check that version number corresponds to git tag, usefull in CI/CD to validate that new version published on GitHub has same version in sources" OFF) -OPTION (BUILD_GTEST "Build Google Test" OFF) +OPTION (BUILD_GTEST "Build Google Test" ON) PROJECT (TIMEPLUS-CLIENT VERSION "${TIMEPLUS_CPP_VERSION}" @@ -115,7 +115,7 @@ IF (BUILD_GTEST) INCLUDE_DIRECTORIES (contrib/gtest/include contrib/gtest) SUBDIRS ( contrib/gtest - # ut + ut ) ENDIF (BUILD_GTEST) diff --git a/tests/simple/main.cpp b/tests/simple/main.cpp index ad66290..0326def 100644 --- a/tests/simple/main.cpp +++ b/tests/simple/main.cpp @@ -47,8 +47,8 @@ int main() { ClientOptions client_options; client_options - .SetHost(getEnvOrDefault("TIMEPLUS_HOST", "localhost")) - .SetPort(std::stoi(getEnvOrDefault("TIMEPLUS_PORT", "8463"))) + .SetHost(("localhost")) + .SetPort(std::stoi("8463")) .SetPingBeforeQuery(true); // auto start_of_insert = std::chrono::high_resolution_clock::now(); diff --git a/ut/Column_ut.cpp b/ut/Column_ut.cpp index 9ada0b3..752941e 100644 --- a/ut/Column_ut.cpp +++ b/ut/Column_ut.cpp @@ -131,9 +131,9 @@ class GenericColumnTest : public testing::Test { timeplus::Client client(client_options); - if (auto message = CheckIfShouldSkipTest(client)) { - GTEST_SKIP() << *message; - } + // if (auto message = CheckIfShouldSkipTest(client)) { + // GTEST_SKIP() << *message; + // } auto result_typed = RoundtripColumnValues(client, column)->template AsStrict(); EXPECT_TRUE(CompareRecursive(*column, *result_typed)); diff --git a/ut/client_ut.cpp b/ut/client_ut.cpp index c1c2435..fce9fd6 100644 --- a/ut/client_ut.cpp +++ b/ut/client_ut.cpp @@ -463,10 +463,10 @@ TEST_P(ClientCase, Numbers) { } TEST_P(ClientCase, SimpleAggregateFunction) { - const auto & server_info = client_->GetServerInfo(); - if (versionNumber(server_info) < versionNumber(19, 9)) { - GTEST_SKIP() << "Test is skipped since server '" << server_info << "' does not support SimpleAggregateFunction" << std::endl; - } + // const auto & server_info = client_->GetServerInfo(); + // if (versionNumber(server_info) < versionNumber(19, 9)) { + // GTEST_SKIP() << "Test is skipped since server '" << server_info << "' does not support SimpleAggregateFunction" << std::endl; + // } client_->Execute("DROP TEMPORARY STREAM IF EXISTS test_timeplus_cpp_SimpleAggregateFunction"); client_->Execute( @@ -791,9 +791,9 @@ TEST_P(ClientCase, Decimal) { // Test special chars in names TEST_P(ClientCase, ColEscapeNameTest) { - client_->Execute(R"sql(DROP TEMPORARY STREAM IF EXISTS "test_timeplus_cpp_col_escape_" "name_test";)sql"); + client_->Execute(R"sql(DROP TEMPORARY STREAM IF EXISTS "test_timeplus_cpp_col_escape_ name_test";)sql"); - client_->Execute(R"sql(CREATE TEMPORARY STREAM IF NOT EXISTS "test_timeplus_cpp_col_escape_" "name_test" ("test space" uint64, "test "" quote" uint64, "test ""`'[]&_\ all" uint64) ENGINE = Memory)sql"); + client_->Execute(R"sql(CREATE TEMPORARY STREAM IF NOT EXISTS "test_timeplus_cpp_col_escape_ name_test" ("test space" uint64, "test "" quote" uint64, "test ""`'[]&_\ all" uint64) ENGINE = Memory)sql"); auto col1 = std::make_shared(); col1->Append(1); @@ -817,8 +817,8 @@ TEST_P(ClientCase, ColEscapeNameTest) { block.AppendColumn(column_names[1], col2); block.AppendColumn(column_names[2], col3); - client_->Insert(R"sql("test_timeplus_cpp_col_escape_" "name_test")sql", block); - client_->Select(R"sql(SELECT * FROM "test_timeplus_cpp_col_escape_" "name_test")sql", [] (const Block& sblock) + client_->Insert(R"sql("test_timeplus_cpp_col_escape_ name_test")sql", block); + client_->Select(R"sql(SELECT * FROM "test_timeplus_cpp_col_escape_ name_test")sql", [] (const Block& sblock) { int row = sblock.GetRowCount(); if (row <= 0) {return;} @@ -839,10 +839,10 @@ TEST_P(ClientCase, ColEscapeNameTest) { // Test roundtrip of datetime64 values TEST_P(ClientCase, datetime64) { - const auto & server_info = client_->GetServerInfo(); - if (versionNumber(server_info) < versionNumber(20, 1)) { - GTEST_SKIP() << "Test is skipped since server '" << server_info << "' does not support datetime64" << std::endl; - } + // const auto & server_info = client_->GetServerInfo(); + // if (versionNumber(server_info) < versionNumber(20, 1)) { + // GTEST_SKIP() << "Test is skipped since server '" << server_info << "' does not support datetime64" << std::endl; + // } Block block; client_->Execute("DROP TEMPORARY STREAM IF EXISTS test_timeplus_cpp_datetime64;"); @@ -930,11 +930,11 @@ TEST_P(ClientCase, Query_ID) { " WHERE type = 'QueryStart' AND query_id == '" + query_id +"'", [&total_count](const Block & block) { total_count += block.GetRowCount(); -// std::cerr << PrettyPrintBlock{block} << std::endl; + // std::cerr << PrettyPrintBlock{block} << std::endl; }); - // We've executed 5 queries with explicit query_id, hence we expect to see 5 entries in logs. - EXPECT_EQ(5u, total_count); + // We've executed 4 queries with explicit query_id, hence we expect to see 4 entries in logs. + EXPECT_EQ(4u, total_count); } // Spontaneosly fails on INSERTint data. @@ -1111,7 +1111,8 @@ TEST_P(ClientCase, ServerLogs) { }); client_->Execute(query); - EXPECT_GT(received_row_count, 0U); + // EXPECT_GT(received_row_count, 0U); + EXPECT_EQ(received_row_count, 0U); // Proton won't record insert } TEST_P(ClientCase, TracingContext) { @@ -1128,9 +1129,9 @@ TEST_P(ClientCase, TracingContext) { FlushLogs(); size_t received_rows = 0; - client_->Select("SELECT trace_id, toString(trace_id), operation_name " + client_->Select("SELECT trace_id, to_string(trace_id), operation_name " "FROM system.opentelemetry_span_log " - "WHERE trace_id = toUUID(\'" + ToString(tracing_context.trace_id) + "\');", + "WHERE trace_id = to_uuid(\'" + ToString(tracing_context.trace_id) + "\');", [&](const Block& block) { // std::cerr << PrettyPrintBlock{block} << std::endl; received_rows += block.GetRowCount();