diff --git a/.github/workflows/pr_check.yaml b/.github/workflows/examples.yaml similarity index 90% rename from .github/workflows/pr_check.yaml rename to .github/workflows/examples.yaml index 973b2671fef..def8ce1fa1b 100644 --- a/.github/workflows/pr_check.yaml +++ b/.github/workflows/examples.yaml @@ -1,4 +1,4 @@ -name: PR-check +name: Examples on: push: @@ -10,13 +10,17 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} cancel-in-progress: true -jobs: +jobs: main: - name: PR check for YDB C++ SDK + name: Examples runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + ydb-version: [23.3, 24.1, trunk] services: ydb: - image: ydbplatform/local-ydb:latest + image: ydbplatform/local-ydb:${{ matrix.ydb-version }} ports: - 2135:2135 - 2136:2136 @@ -57,10 +61,6 @@ jobs: ubuntu-22.04-ccache- - name: Build uses: ./.github/actions/build - - name: Test - shell: bash - run: | - ctest -j32 --preset release - name: Launch basic example shell: bash run: | diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 00000000000..fe40c3407eb --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,112 @@ +name: Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true +jobs: + unit: + concurrency: + group: unit-${{ github.ref }}-${{ matrix.os }} + cancel-in-progress: true + strategy: + fail-fast: false + env: + OS: ubuntu-22.04 + runs-on: ubuntu-22.04 + steps: + - name: Checkout PR + uses: actions/checkout@v3 + if: github.event.pull_request.head.sha != '' + with: + submodules: true + ref: ${{ github.event.pull_request.head.sha }} + - name: Checkout + uses: actions/checkout@v3 + if: github.event.pull_request.head.sha == '' + with: + submodules: true + - name: Install dependencies + uses: ./.github/actions/prepare_vm + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::set-output name=timestamp::${current_date}") + - name: Restore cache files + uses: actions/cache/restore@v4 + with: + path: ~/.ccache + key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + restore-keys: | + ubuntu-22.04-ccache- + - name: Build + uses: ./.github/actions/build + - name: Test + shell: bash + run: | + ctest -j32 --preset release-unit + + integration: + concurrency: + group: integration-${{ github.ref }}-${{ matrix.ydb-version }} + cancel-in-progress: true + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + ydb-version: [23.3, 24.1, trunk] + services: + ydb: + image: ydbplatform/local-ydb:${{ matrix.ydb-version }} + ports: + - 2135:2135 + - 2136:2136 + - 8765:8765 + volumes: + - /tmp/ydb_certs:/ydb_certs + env: + YDB_LOCAL_SURVIVE_RESTART: true + YDB_USE_IN_MEMORY_PDISKS: true + YDB_TABLE_ENABLE_PREPARED_DDL: true + options: '-h localhost' + steps: + - name: Checkout PR + uses: actions/checkout@v3 + if: github.event.pull_request.head.sha != '' + with: + submodules: true + ref: ${{ github.event.pull_request.head.sha }} + - name: Checkout + uses: actions/checkout@v3 + if: github.event.pull_request.head.sha == '' + with: + submodules: true + - name: Install dependencies + uses: ./.github/actions/prepare_vm + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::set-output name=timestamp::${current_date}") + - name: Restore cache files + uses: actions/cache/restore@v4 + with: + path: ~/.ccache + key: ubuntu-22.04-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}} + restore-keys: | + ubuntu-22.04-ccache- + - name: Build + uses: ./.github/actions/build + - name: Test + shell: bash + run: | + ctest -j32 --preset release-integration diff --git a/CMakeLists.txt b/CMakeLists.txt index e77c6294227..152a6866e5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,8 @@ endif() if (YDB_SDK_TESTS) enable_testing() - add_subdirectory(tests) + add_subdirectory(tests/unit) + add_subdirectory(tests/integration) endif() if (YDB_SDK_INSTALL) diff --git a/CMakePresets.json b/CMakePresets.json index c6a68e365a3..0a2b024500f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -59,6 +59,46 @@ }, "execution": { "timeout": 1200 + }, + "environment": { + "YDB_ENDPOINT": "localhost:2136", + "YDB_DATABASE": "/local" + } + }, + { + "name": "release-unit", + "configurePreset": "release", + "displayName": "Default Unit Release Tests", + "filter" : { + "include": { + "label": "unit" + } + }, + "output": { + "outputOnFailure": true + }, + "execution": { + "timeout": 1200 + } + }, + { + "name": "release-integration", + "configurePreset": "release", + "displayName": "Default Integration Release Tests", + "output": { + "outputOnFailure": true + }, + "filter" : { + "include": { + "label": "integration" + } + }, + "execution": { + "timeout": 1200 + }, + "environment": { + "YDB_ENDPOINT": "localhost:2136", + "YDB_DATABASE": "/local" } } ] diff --git a/README.md b/README.md index c7d5c734dd0..1e3355def5d 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,20 @@ cmake --build --preset release Specify a level of parallelism by passing the `-j` option into the command below (e.g. `-j$(nproc)`) +Running all tests: + ```bash ctest -j$(nproc) --preset release ``` + +Running unit tests only: + +```bash +ctest -j$(nproc) --preset release-unit +``` + +Running integration tests only: + +```bash +ctest -j$(nproc) --preset release-integration +``` \ No newline at end of file diff --git a/cmake/testing.cmake b/cmake/testing.cmake index 3d1ac921d89..bed39d0bc63 100644 --- a/cmake/testing.cmake +++ b/cmake/testing.cmake @@ -60,7 +60,7 @@ endfunction() function(add_ydb_test) set(opts "") set(oneval_args NAME) - set(multival_args INCLUDE_DIRS SOURCES LINK_LIBRARIES) + set(multival_args INCLUDE_DIRS SOURCES LINK_LIBRARIES LABELS) cmake_parse_arguments(YDB_TEST "${opts}" "${oneval_args}" @@ -121,6 +121,7 @@ function(add_ydb_test) PROPERTY LABELS MEDIUM + ${YDB_TEST_LABELS} ) set_yunittest_property( diff --git a/examples/basic_example/basic_example.cpp b/examples/basic_example/basic_example.cpp index bc51087b051..e52092d8f8c 100644 --- a/examples/basic_example/basic_example.cpp +++ b/examples/basic_example/basic_example.cpp @@ -2,8 +2,6 @@ #include -#include - #include #include diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt new file mode 100644 index 00000000000..a7a4e7c9715 --- /dev/null +++ b/tests/integration/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(basic_example_it) diff --git a/tests/integration/basic_example_it/CMakeLists.txt b/tests/integration/basic_example_it/CMakeLists.txt new file mode 100644 index 00000000000..e225a21c8ee --- /dev/null +++ b/tests/integration/basic_example_it/CMakeLists.txt @@ -0,0 +1,14 @@ +add_ydb_test(NAME basic-example_it + SOURCES + main.cpp + basic_example_data.cpp + basic_example.cpp + basic_example.h + LINK_LIBRARIES + yutil + YDB-CPP-SDK::Table + GTest::gtest_main + public-lib-json_value + LABELS + integration +) diff --git a/tests/integration/basic_example_it/basic_example.cpp b/tests/integration/basic_example_it/basic_example.cpp new file mode 100644 index 00000000000..c0d8a0c3161 --- /dev/null +++ b/tests/integration/basic_example_it/basic_example.cpp @@ -0,0 +1,522 @@ +#include "basic_example.h" + +#include + +#include +#include + +using namespace NYdb; +using namespace NYdb::NTable; + +void ThrowOnError(const TStatus& status) { + if (!status.IsSuccess()) { + throw TYdbErrorException(status) << status; + } +} + +static std::string JoinPath(const std::string& basePath, const std::string& path) { + if (basePath.empty()) { + return path; + } + + std::filesystem::path prefixPathSplit(basePath); + prefixPathSplit /= path; + + return prefixPathSplit; +} + +TRunArgs GetRunArgs() { + + std::string database = std::getenv("YDB_DATABASE"); + std::string endpoint = std::getenv("YDB_ENDPOINT"); + + auto driverConfig = TDriverConfig() + .SetEndpoint(endpoint) + .SetDatabase(database) + .SetAuthToken(std::getenv("YDB_TOKEN") ? std::getenv("YDB_TOKEN") : ""); + + TDriver driver(driverConfig); + return {driver, JoinPath(database, "basic")}; +} + +/////////////////////////////////////////////////////////////////////////////// + +//! Creates sample tables with CrateTable API. +void CreateTables(TTableClient client, const std::string& path) { + ThrowOnError(client.RetryOperationSync([path](TSession session) { + auto seriesDesc = TTableBuilder() + .AddNullableColumn("series_id", EPrimitiveType::Uint64) + .AddNullableColumn("title", EPrimitiveType::Utf8) + .AddNullableColumn("series_info", EPrimitiveType::Utf8) + .AddNullableColumn("release_date", EPrimitiveType::Uint64) + .SetPrimaryKeyColumn("series_id") + .Build(); + + return session.CreateTable(JoinPath(path, "series"), std::move(seriesDesc)).GetValueSync(); + })); + + ThrowOnError(client.RetryOperationSync([path](TSession session) { + auto seasonsDesc = TTableBuilder() + .AddNullableColumn("series_id", EPrimitiveType::Uint64) + .AddNullableColumn("season_id", EPrimitiveType::Uint64) + .AddNullableColumn("title", EPrimitiveType::Utf8) + .AddNullableColumn("first_aired", EPrimitiveType::Uint64) + .AddNullableColumn("last_aired", EPrimitiveType::Uint64) + .SetPrimaryKeyColumns({"series_id", "season_id"}) + .Build(); + + return session.CreateTable(JoinPath(path, "seasons"), std::move(seasonsDesc)).GetValueSync(); + })); + + ThrowOnError(client.RetryOperationSync([path](TSession session) { + auto episodesDesc = TTableBuilder() + .AddNullableColumn("series_id", EPrimitiveType::Uint64) + .AddNullableColumn("season_id", EPrimitiveType::Uint64) + .AddNullableColumn("episode_id", EPrimitiveType::Uint64) + .AddNullableColumn("title", EPrimitiveType::Utf8) + .AddNullableColumn("air_date", EPrimitiveType::Uint64) + .SetPrimaryKeyColumns({"series_id", "season_id", "episode_id"}) + .Build(); + + return session.CreateTable(JoinPath(path, "episodes"), + std::move(episodesDesc)).GetValueSync(); + })); +} + +/////////////////////////////////////////////////////////////////////////////// + +//! Fills sample tables with data in single parameterized data query. +TStatus FillTableDataTransaction(TSession session, const std::string& path) { + auto query = std::format(R"( + PRAGMA TablePathPrefix("{}"); + + DECLARE $seriesData AS List>; + + DECLARE $seasonsData AS List>; + + DECLARE $episodesData AS List>; + + REPLACE INTO series + SELECT + series_id, + title, + series_info, + CAST(release_date AS Uint16) AS release_date + FROM AS_TABLE($seriesData); + + REPLACE INTO seasons + SELECT + series_id, + season_id, + title, + CAST(first_aired AS Uint16) AS first_aired, + CAST(last_aired AS Uint16) AS last_aired + FROM AS_TABLE($seasonsData); + + REPLACE INTO episodes + SELECT + series_id, + season_id, + episode_id, + title, + CAST(air_date AS Uint16) AS air_date + FROM AS_TABLE($episodesData); + )", path); + + auto params = GetTablesDataParams(); + + return session.ExecuteDataQuery( + query, + TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx(), + params).GetValueSync(); +} + +//! Shows basic usage of YDB data queries and transactions. +static TStatus SelectSimpleTransaction(TSession session, const std::string& path, + std::optional& resultSet) +{ + auto query = std::format(R"( + PRAGMA TablePathPrefix("{}"); + + SELECT series_id, title, CAST(CAST(release_date AS Date) AS String) AS release_date + FROM series + WHERE series_id = 1 + ORDER BY series_id; + )", path); + + auto txControl = + // Begin new transaction with SerializableRW mode + TTxControl::BeginTx(TTxSettings::SerializableRW()) + // Commit transaction at the end of the query + .CommitTx(); + + // Executes data query with specified transaction control settings. + auto result = session.ExecuteDataQuery(query, txControl).GetValueSync(); + + if (result.IsSuccess()) { + // Index of result set corresponds to its order in YQL query + resultSet = result.GetResultSet(0); + } + + return result; +} + +//! Shows basic usage of mutating operations. +static TStatus UpsertSimpleTransaction(TSession session, const std::string& path) { + auto query = std::format(R"( + --!syntax_v1 + PRAGMA TablePathPrefix("{}"); + + UPSERT INTO episodes (series_id, season_id, episode_id, title) VALUES + (2, 6, 1, "TBD"); + )", path); + + return session.ExecuteDataQuery(query, + TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).GetValueSync(); +} + +//! Shows usage of parameters in data queries. +static TStatus SelectWithParamsTransaction(TSession session, const std::string& path, + uint64_t seriesId, uint64_t seasonId, std::optional& resultSet) +{ + auto query = std::format(R"( + --!syntax_v1 + PRAGMA TablePathPrefix("{}"); + + DECLARE $seriesId AS Uint64; + DECLARE $seasonId AS Uint64; + + SELECT sa.title AS season_title, sr.title AS series_title + FROM seasons AS sa + INNER JOIN series AS sr + ON sa.series_id = sr.series_id + WHERE sa.series_id = $seriesId AND sa.season_id = $seasonId + ORDER BY season_title, series_title; + )", path); + + // Type of parameter values should be exactly the same as in DECLARE statements. + auto params = session.GetParamsBuilder() + .AddParam("$seriesId") + .Uint64(seriesId) + .Build() + .AddParam("$seasonId") + .Uint64(seasonId) + .Build() + .Build(); + + auto result = session.ExecuteDataQuery( + query, + TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx(), + params).GetValueSync(); + + if (result.IsSuccess()) { + resultSet = result.GetResultSet(0); + } + + return result; +} + +//! Shows usage of prepared queries. +static TStatus PreparedSelectTransaction(TSession session, const std::string& path, + uint64_t seriesId, uint64_t seasonId, uint64_t episodeId, std::optional& resultSet) +{ + // Once prepared, query data is stored in the session and identified by QueryId. + // Local query cache is used to keep track of queries, prepared in current session. + auto query = std::format(R"( + --!syntax_v1 + PRAGMA TablePathPrefix("{}"); + + DECLARE $seriesId AS Uint64; + DECLARE $seasonId AS Uint64; + DECLARE $episodeId AS Uint64; + + SELECT * + FROM episodes + WHERE series_id = $seriesId AND season_id = $seasonId AND episode_id = $episodeId + ORDER BY season_id, episode_id; + )", path); + + // Prepare query or get result from query cache + auto prepareResult = session.PrepareDataQuery(query).GetValueSync(); + if (!prepareResult.IsSuccess()) { + return prepareResult; + } + + auto dataQuery = prepareResult.GetQuery(); + + auto params = dataQuery.GetParamsBuilder() + .AddParam("$seriesId") + .Uint64(seriesId) + .Build() + .AddParam("$seasonId") + .Uint64(seasonId) + .Build() + .AddParam("$episodeId") + .Uint64(episodeId) + .Build() + .Build(); + + auto result = dataQuery.Execute(TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx(), + params).GetValueSync(); + + if (result.IsSuccess()) { + resultSet = result.GetResultSet(0); + } + + return result; +} + +//! Shows usage of transactions consisting of multiple data queries with client logic between them. +static TStatus MultiStepTransaction(TSession session, const std::string& path, uint64_t seriesId, uint64_t seasonId, + std::optional& resultSet) +{ + auto query1 = std::format(R"( + --!syntax_v1 + PRAGMA TablePathPrefix("{}"); + + DECLARE $seriesId AS Uint64; + DECLARE $seasonId AS Uint64; + + SELECT first_aired AS from_date FROM seasons + WHERE series_id = $seriesId AND season_id = $seasonId + ORDER BY from_date; + )", path); + + auto params1 = session.GetParamsBuilder() + .AddParam("$seriesId") + .Uint64(seriesId) + .Build() + .AddParam("$seasonId") + .Uint64(seasonId) + .Build() + .Build(); + + // Execute first query to get the required values to the client. + // Transaction control settings don't set CommitTx flag to keep transaction active + // after query execution. + auto result = session.ExecuteDataQuery( + query1, + TTxControl::BeginTx(TTxSettings::SerializableRW()), + params1).GetValueSync(); + + if (!result.IsSuccess()) { + return result; + } + + // Get active transaction id + auto tx = result.GetTransaction(); + + TResultSetParser parser(result.GetResultSet(0)); + parser.TryNextRow(); + auto date = parser.ColumnParser("from_date").GetOptionalUint64(); + + // Perform some client logic on returned values + auto userFunc = [] (const TInstant fromDate) { + return fromDate + TDuration::Days(15); + }; + + TInstant fromDate = TInstant::Days(*date); + TInstant toDate = userFunc(fromDate); + + // Construct next query based on the results of client logic + auto query2 = std::format(R"( + --!syntax_v1 + PRAGMA TablePathPrefix("{}"); + + DECLARE $seriesId AS Uint64; + DECLARE $fromDate AS Uint64; + DECLARE $toDate AS Uint64; + + SELECT season_id, episode_id, title, air_date FROM episodes + WHERE series_id = $seriesId AND air_date >= $fromDate AND air_date <= $toDate + ORDER BY season_id, episode_id; + )", path); + + auto params2 = session.GetParamsBuilder() + .AddParam("$seriesId") + .Uint64(seriesId) + .Build() + .AddParam("$fromDate") + .Uint64(fromDate.Days()) + .Build() + .AddParam("$toDate") + .Uint64(toDate.Days()) + .Build() + .Build(); + + // Execute second query. + // Transaction control settings continues active transaction (tx) and + // commits it at the end of second query execution. + result = session.ExecuteDataQuery( + query2, + TTxControl::Tx(*tx).CommitTx(), + params2).GetValueSync(); + + if (result.IsSuccess()) { + resultSet = result.GetResultSet(0); + } + + return result; +} + +// Show usage of explicit Begin/Commit transaction control calls. +// In most cases it's better to use transaction control settings in ExecuteDataQuery calls instead +// to avoid additional hops to YDB cluster and allow more efficient execution of queries. +static TStatus ExplicitTclTransaction(TSession session, const std::string& path, const TInstant& airDate) { + auto beginResult = session.BeginTransaction(TTxSettings::SerializableRW()).GetValueSync(); + if (!beginResult.IsSuccess()) { + return beginResult; + } + + // Get newly created transaction id + auto tx = beginResult.GetTransaction(); + + auto query = std::format(R"( + --!syntax_v1 + PRAGMA TablePathPrefix("{}"); + + DECLARE $airDate AS Date; + + UPDATE episodes SET air_date = CAST($airDate AS Uint16) WHERE title = "TBD"; + )", path); + + auto params = session.GetParamsBuilder() + .AddParam("$airDate") + .Date(airDate) + .Build() + .Build(); + + // Execute data query. + // Transaction control settings continues active transaction (tx) + auto updateResult = session.ExecuteDataQuery(query, + TTxControl::Tx(tx), + params).GetValueSync(); + + if (!updateResult.IsSuccess()) { + return updateResult; + } + + // Commit active transaction (tx) + return tx.Commit().GetValueSync(); +} + +static TStatus ScanQuerySelect(TTableClient client, const std::string& path, std::vector & vectorResultSet) { + std::vector result; + auto query = std::format(R"( + --!syntax_v1 + PRAGMA TablePathPrefix("{}"); + + DECLARE $series AS List; + + SELECT series_id, season_id, title, CAST(CAST(first_aired AS Date) AS String) AS first_aired + FROM seasons + WHERE series_id IN $series + ORDER BY season_id; + )", path); + + auto parameters = TParamsBuilder() + .AddParam("$series") + .BeginList() + .AddListItem().Uint64(1) + .AddListItem().Uint64(10) + .EndList().Build() + .Build(); + + // Executes scan query + auto resultScanQuery = client.StreamExecuteScanQuery(query, parameters).GetValueSync(); + + if (!resultScanQuery.IsSuccess()) { + return resultScanQuery; + } + + bool eos = false; + + while (!eos) { + auto streamPart = resultScanQuery.ReadNext().ExtractValueSync(); + + if (!streamPart.IsSuccess()) { + eos = true; + if (!streamPart.EOS()) { + return streamPart; + } + continue; + } + + if (streamPart.HasResultSet()) { + auto rs = streamPart.ExtractResultSet(); + vectorResultSet.push_back(rs); + } + } + return TStatus(EStatus::SUCCESS, NYql::TIssues()); +} + +/////////////////////////////////////////////////////////////////////////////// + +std::string SelectSimple(TTableClient client, const std::string& path) { + std::optional resultSet; + ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { + return SelectSimpleTransaction(session, path, resultSet); + })); + return FormatResultSetJson(resultSet.value(), EBinaryStringEncoding::Unicode); +} + +void UpsertSimple(TTableClient client, const std::string& path) { + ThrowOnError(client.RetryOperationSync([path](TSession session) { + return UpsertSimpleTransaction(session, path); + })); +} + +std::string SelectWithParams(TTableClient client, const std::string& path) { + std::optional resultSet; + std::string result; + ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { + return SelectWithParamsTransaction(session, path, 2, 3, resultSet); + })); + return FormatResultSetJson(resultSet.value(), EBinaryStringEncoding::Unicode); +} + +std::string PreparedSelect(TTableClient client, const std::string& path, ui32 seriesId, ui32 seasonId, ui32 episodeId) { + std::optional resultSet; + ThrowOnError(client.RetryOperationSync([path, seriesId, seasonId, episodeId, &resultSet](TSession session) { + return PreparedSelectTransaction(session, path, seriesId, seasonId, episodeId, resultSet); + })); + return FormatResultSetJson(resultSet.value(), EBinaryStringEncoding::Unicode); +} + +std::string MultiStep(TTableClient client, const std::string& path) { + std::optional resultSet; + ThrowOnError(client.RetryOperationSync([path, &resultSet](TSession session) { + return MultiStepTransaction(session, path, 2, 5, resultSet); + })); + return FormatResultSetJson(resultSet.value(), EBinaryStringEncoding::Unicode); +} + +void ExplicitTcl(TTableClient client, const std::string& path) { + ThrowOnError(client.RetryOperationSync([path](TSession session) { + return ExplicitTclTransaction(session, path, TInstant()); + })); +} + +std::vector ScanQuerySelect(TTableClient client, const std::string& path) { + std::vector vectorResultSet; + ThrowOnError(client.RetryOperationSync([path, &vectorResultSet](TTableClient& client) { + return ScanQuerySelect(client, path, vectorResultSet); + })); + std::vector resultJson(vectorResultSet.size()); + std::transform(vectorResultSet.begin(), vectorResultSet.end(), resultJson.begin(), [](TResultSet& x){return FormatResultSetJson(x, EBinaryStringEncoding::Unicode);}); + return resultJson; +} diff --git a/tests/integration/basic_example_it/basic_example.h b/tests/integration/basic_example_it/basic_example.h new file mode 100644 index 00000000000..9328880d25c --- /dev/null +++ b/tests/integration/basic_example_it/basic_example.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include + +#include + +using namespace NYdb; +using namespace NYdb::NTable; + +struct TRunArgs { + TDriver driver; + std::string path; +}; +class TYdbErrorException : public yexception { +public: + TYdbErrorException(const TStatus& status) + : Status(status) {} + + TStatus Status; +}; + +NYdb::TParams GetTablesDataParams(); + +void CreateTables(TTableClient client, const std::string& path); +void ThrowOnError(const TStatus& status); +TRunArgs GetRunArgs(); +TStatus FillTableDataTransaction(TSession session, const std::string& path); +std::string SelectSimple(TTableClient client, const std::string& path); +void UpsertSimple(TTableClient client, const std::string& path); +std::string SelectWithParams(TTableClient client, const std::string& path); +std::string PreparedSelect(TTableClient client, const std::string& path, ui32 seriesId, ui32 seasonId, ui32 episodeId); +std::string MultiStep(TTableClient client, const std::string& path); +void ExplicitTcl(TTableClient client, const std::string& path); +std::string PreparedSelect(TTableClient client, const std::string& path, ui32 seriesId, ui32 seasonId, ui32 episodeId); +std::vector ScanQuerySelect(TTableClient client, const std::string& path); diff --git a/tests/integration/basic_example_it/basic_example_data.cpp b/tests/integration/basic_example_it/basic_example_data.cpp new file mode 100644 index 00000000000..e27bf1528c7 --- /dev/null +++ b/tests/integration/basic_example_it/basic_example_data.cpp @@ -0,0 +1,205 @@ +#include "basic_example.h" + +using namespace NYdb; +using namespace NYdb::NTable; + +struct TSeries { + ui64 SeriesId; + std::string Title; + TInstant ReleaseDate; + std::string SeriesInfo; + + TSeries(ui64 seriesId, const std::string& title, const TInstant& releaseDate, const std::string& seriesInfo) + : SeriesId(seriesId) + , Title(title) + , ReleaseDate(releaseDate) + , SeriesInfo(seriesInfo) {} +}; + +struct TSeason { + ui64 SeriesId; + ui64 SeasonId; + std::string Title; + TInstant FirstAired; + TInstant LastAired; + + TSeason(ui64 seriesId, ui64 seasonId, const std::string& title, const TInstant& firstAired, const TInstant& lastAired) + : SeriesId(seriesId) + , SeasonId(seasonId) + , Title(title) + , FirstAired(firstAired) + , LastAired(lastAired) {} +}; + +struct TEpisode { + ui64 SeriesId; + ui64 SeasonId; + ui64 EpisodeId; + std::string Title; + TInstant AirDate; + + TEpisode(ui64 seriesId, ui64 seasonId, ui64 episodeId, const std::string& title, const TInstant& airDate) + : SeriesId(seriesId) + , SeasonId(seasonId) + , EpisodeId(episodeId) + , Title(title) + , AirDate(airDate) {} +}; + +TParams GetTablesDataParams() { + std::vector seriesData = { + TSeries(1, "IT Crowd", TInstant::ParseIso8601("2006-02-03"), + "The IT Crowd is a British sitcom produced by Channel 4, written by Graham Linehan, produced by " + "Ash Atalla and starring Chris O'Dowd, Richard Ayoade, Katherine Parkinson, and Matt Berry."), + TSeries(2, "Silicon Valley", TInstant::ParseIso8601("2014-04-06"), + "Silicon Valley is an American comedy television series created by Mike Judge, John Altschuler and " + "Dave Krinsky. The series focuses on five young men who founded a startup company in Silicon Valley.") + }; + + std::vector seasonsData = { + TSeason(1, 1, "Season 1", TInstant::ParseIso8601("2006-02-03"), TInstant::ParseIso8601("2006-03-03")), + TSeason(1, 2, "Season 2", TInstant::ParseIso8601("2007-08-24"), TInstant::ParseIso8601("2007-09-28")), + TSeason(1, 3, "Season 3", TInstant::ParseIso8601("2008-11-21"), TInstant::ParseIso8601("2008-12-26")), + TSeason(1, 4, "Season 4", TInstant::ParseIso8601("2010-06-25"), TInstant::ParseIso8601("2010-07-30")), + TSeason(2, 1, "Season 1", TInstant::ParseIso8601("2014-04-06"), TInstant::ParseIso8601("2014-06-01")), + TSeason(2, 2, "Season 2", TInstant::ParseIso8601("2015-04-12"), TInstant::ParseIso8601("2015-06-14")), + TSeason(2, 3, "Season 3", TInstant::ParseIso8601("2016-04-24"), TInstant::ParseIso8601("2016-06-26")), + TSeason(2, 4, "Season 4", TInstant::ParseIso8601("2017-04-23"), TInstant::ParseIso8601("2017-06-25")), + TSeason(2, 5, "Season 5", TInstant::ParseIso8601("2018-03-25"), TInstant::ParseIso8601("2018-05-13")) + }; + + std::vector episodesData = { + TEpisode(1, 1, 1, "Yesterday's Jam", TInstant::ParseIso8601("2006-02-03")), + TEpisode(1, 1, 2, "Calamity Jen", TInstant::ParseIso8601("2006-02-03")), + TEpisode(1, 1, 3, "Fifty-Fifty", TInstant::ParseIso8601("2006-02-10")), + TEpisode(1, 1, 4, "The Red Door", TInstant::ParseIso8601("2006-02-17")), + TEpisode(1, 1, 5, "The Haunting of Bill Crouse", TInstant::ParseIso8601("2006-02-24")), + TEpisode(1, 1, 6, "Aunt Irma Visits", TInstant::ParseIso8601("2006-03-03")), + TEpisode(1, 2, 1, "The Work Outing", TInstant::ParseIso8601("2006-08-24")), + TEpisode(1, 2, 2, "Return of the Golden Child", TInstant::ParseIso8601("2007-08-31")), + TEpisode(1, 2, 3, "Moss and the German", TInstant::ParseIso8601("2007-09-07")), + TEpisode(1, 2, 4, "The Dinner Party", TInstant::ParseIso8601("2007-09-14")), + TEpisode(1, 2, 5, "Smoke and Mirrors", TInstant::ParseIso8601("2007-09-21")), + TEpisode(1, 2, 6, "Men Without Women", TInstant::ParseIso8601("2007-09-28")), + TEpisode(1, 3, 1, "From Hell", TInstant::ParseIso8601("2008-11-21")), + TEpisode(1, 3, 2, "Are We Not Men?", TInstant::ParseIso8601("2008-11-28")), + TEpisode(1, 3, 3, "Tramps Like Us", TInstant::ParseIso8601("2008-12-05")), + TEpisode(1, 3, 4, "The Speech", TInstant::ParseIso8601("2008-12-12")), + TEpisode(1, 3, 5, "Friendface", TInstant::ParseIso8601("2008-12-19")), + TEpisode(1, 3, 6, "Calendar Geeks", TInstant::ParseIso8601("2008-12-26")), + TEpisode(1, 4, 1, "Jen The Fredo", TInstant::ParseIso8601("2010-06-25")), + TEpisode(1, 4, 2, "The Final Countdown", TInstant::ParseIso8601("2010-07-02")), + TEpisode(1, 4, 3, "Something Happened", TInstant::ParseIso8601("2010-07-09")), + TEpisode(1, 4, 4, "Italian For Beginners", TInstant::ParseIso8601("2010-07-16")), + TEpisode(1, 4, 5, "Bad Boys", TInstant::ParseIso8601("2010-07-23")), + TEpisode(1, 4, 6, "Reynholm vs Reynholm", TInstant::ParseIso8601("2010-07-30")), + TEpisode(2, 1, 1, "Minimum Viable Product", TInstant::ParseIso8601("2014-04-06")), + TEpisode(2, 1, 2, "The Cap Table", TInstant::ParseIso8601("2014-04-13")), + TEpisode(2, 1, 3, "Articles of Incorporation", TInstant::ParseIso8601("2014-04-20")), + TEpisode(2, 1, 4, "Fiduciary Duties", TInstant::ParseIso8601("2014-04-27")), + TEpisode(2, 1, 5, "Signaling Risk", TInstant::ParseIso8601("2014-05-04")), + TEpisode(2, 1, 6, "Third Party Insourcing", TInstant::ParseIso8601("2014-05-11")), + TEpisode(2, 1, 7, "Proof of Concept", TInstant::ParseIso8601("2014-05-18")), + TEpisode(2, 1, 8, "Optimal Tip-to-Tip Efficiency", TInstant::ParseIso8601("2014-06-01")), + TEpisode(2, 2, 1, "Sand Hill Shuffle", TInstant::ParseIso8601("2015-04-12")), + TEpisode(2, 2, 2, "Runaway Devaluation", TInstant::ParseIso8601("2015-04-19")), + TEpisode(2, 2, 3, "Bad Money", TInstant::ParseIso8601("2015-04-26")), + TEpisode(2, 2, 4, "The Lady", TInstant::ParseIso8601("2015-05-03")), + TEpisode(2, 2, 5, "Server Space", TInstant::ParseIso8601("2015-05-10")), + TEpisode(2, 2, 6, "Homicide", TInstant::ParseIso8601("2015-05-17")), + TEpisode(2, 2, 7, "Adult Content", TInstant::ParseIso8601("2015-05-24")), + TEpisode(2, 2, 8, "White Hat/Black Hat", TInstant::ParseIso8601("2015-05-31")), + TEpisode(2, 2, 9, "Binding Arbitration", TInstant::ParseIso8601("2015-06-07")), + TEpisode(2, 2, 10, "Two Days of the Condor", TInstant::ParseIso8601("2015-06-14")), + TEpisode(2, 3, 1, "Founder Friendly", TInstant::ParseIso8601("2016-04-24")), + TEpisode(2, 3, 2, "Two in the Box", TInstant::ParseIso8601("2016-05-01")), + TEpisode(2, 3, 3, "Meinertzhagen's Haversack", TInstant::ParseIso8601("2016-05-08")), + TEpisode(2, 3, 4, "Maleant Data Systems Solutions", TInstant::ParseIso8601("2016-05-15")), + TEpisode(2, 3, 5, "The Empty Chair", TInstant::ParseIso8601("2016-05-22")), + TEpisode(2, 3, 6, "Bachmanity Insanity", TInstant::ParseIso8601("2016-05-29")), + TEpisode(2, 3, 7, "To Build a Better Beta", TInstant::ParseIso8601("2016-06-05")), + TEpisode(2, 3, 8, "Bachman's Earnings Over-Ride", TInstant::ParseIso8601("2016-06-12")), + TEpisode(2, 3, 9, "Daily Active Users", TInstant::ParseIso8601("2016-06-19")), + TEpisode(2, 3, 10, "The Uptick", TInstant::ParseIso8601("2016-06-26")), + TEpisode(2, 4, 1, "Success Failure", TInstant::ParseIso8601("2017-04-23")), + TEpisode(2, 4, 2, "Terms of Service", TInstant::ParseIso8601("2017-04-30")), + TEpisode(2, 4, 3, "Intellectual Property", TInstant::ParseIso8601("2017-05-07")), + TEpisode(2, 4, 4, "Teambuilding Exercise", TInstant::ParseIso8601("2017-05-14")), + TEpisode(2, 4, 5, "The Blood Boy", TInstant::ParseIso8601("2017-05-21")), + TEpisode(2, 4, 6, "Customer Service", TInstant::ParseIso8601("2017-05-28")), + TEpisode(2, 4, 7, "The Patent Troll", TInstant::ParseIso8601("2017-06-04")), + TEpisode(2, 4, 8, "The Keenan Vortex", TInstant::ParseIso8601("2017-06-11")), + TEpisode(2, 4, 9, "Hooli-Con", TInstant::ParseIso8601("2017-06-18")), + TEpisode(2, 4, 10, "Server Error", TInstant::ParseIso8601("2017-06-25")), + TEpisode(2, 5, 1, "Grow Fast or Die Slow", TInstant::ParseIso8601("2018-03-25")), + TEpisode(2, 5, 2, "Reorientation", TInstant::ParseIso8601("2018-04-01")), + TEpisode(2, 5, 3, "Chief Operating Officer", TInstant::ParseIso8601("2018-04-08")), + TEpisode(2, 5, 4, "Tech Evangelist", TInstant::ParseIso8601("2018-04-15")), + TEpisode(2, 5, 5, "Facial Recognition", TInstant::ParseIso8601("2018-04-22")), + TEpisode(2, 5, 6, "Artificial Emotional Intelligence", TInstant::ParseIso8601("2018-04-29")), + TEpisode(2, 5, 7, "Initial Coin Offering", TInstant::ParseIso8601("2018-05-06")), + TEpisode(2, 5, 8, "Fifty-One Percent", TInstant::ParseIso8601("2018-05-13")) + }; + + TParamsBuilder paramsBuilder; + + auto& seriesParam = paramsBuilder.AddParam("$seriesData"); + seriesParam.BeginList(); + for (auto& series : seriesData) { + seriesParam.AddListItem() + .BeginStruct() + .AddMember("series_id") + .Uint64(series.SeriesId) + .AddMember("title") + .Utf8(series.Title) + .AddMember("release_date") + .Date(series.ReleaseDate) + .AddMember("series_info") + .Utf8(series.SeriesInfo) + .EndStruct(); + } + seriesParam.EndList(); + seriesParam.Build(); + + auto& seasonsParam = paramsBuilder.AddParam("$seasonsData"); + seasonsParam.BeginList(); + for (auto& season : seasonsData) { + seasonsParam.AddListItem() + .BeginStruct() + .AddMember("series_id") + .Uint64(season.SeriesId) + .AddMember("season_id") + .Uint64(season.SeasonId) + .AddMember("title") + .Utf8(season.Title) + .AddMember("first_aired") + .Date(season.FirstAired) + .AddMember("last_aired") + .Date(season.LastAired) + .EndStruct(); + } + seasonsParam.EndList(); + seasonsParam.Build(); + + auto& episodesParam = paramsBuilder.AddParam("$episodesData"); + episodesParam.BeginList(); + for (auto& episode : episodesData) { + episodesParam.AddListItem() + .BeginStruct() + .AddMember("series_id") + .Uint64(episode.SeriesId) + .AddMember("season_id") + .Uint64(episode.SeasonId) + .AddMember("episode_id") + .Uint64(episode.EpisodeId) + .AddMember("title") + .Utf8(episode.Title) + .AddMember("air_date") + .Date(episode.AirDate) + .EndStruct(); + } + episodesParam.EndList(); + episodesParam.Build(); + + return paramsBuilder.Build(); +} diff --git a/tests/integration/basic_example_it/main.cpp b/tests/integration/basic_example_it/main.cpp new file mode 100644 index 00000000000..ce8a5a23a21 --- /dev/null +++ b/tests/integration/basic_example_it/main.cpp @@ -0,0 +1,63 @@ +#include "basic_example.h" + +#include + +#include +#include +#include + +#include + +TEST(Integration, BasicExample) { + + auto [driver, path] = GetRunArgs(); + + TTableClient client(driver); + + try { + CreateTables(client, path); + + ThrowOnError(client.RetryOperationSync([path](TSession session) { + return FillTableDataTransaction(session, path); + })); + + std::string expectedResultSelectSimple = "{\"series_id\":1,\"title\":\"IT Crowd\",\"release_date\":\"2006-02-03\"}\n"; + std::string resultSelectSimple = SelectSimple(client, path); + ASSERT_EQ(resultSelectSimple, expectedResultSelectSimple); + + UpsertSimple(client, path); + + std::string expectedResultSelectWithParams = "{\"season_title\":\"Season 3\",\"series_title\":\"Silicon Valley\"}\n"; + std::string resultSelectWithParms = SelectWithParams(client, path); + ASSERT_EQ(resultSelectWithParms, expectedResultSelectWithParams); + + std::string expectedResultPreparedSelect1 = "{\"air_date\":16957,\"episode_id\":7,\"season_id\":3,\"series_id\":2,\"title\":\"To Build a Better Beta\"}\n"; + std::string resultPreparedSelect1 = PreparedSelect(client, path, 2, 3, 7); + ASSERT_EQ(resultPreparedSelect1, expectedResultPreparedSelect1); + + std::string expectedResultPreparedSelect2 = "{\"air_date\":16964,\"episode_id\":8,\"season_id\":3,\"series_id\":2,\"title\":\"Bachman's Earnings Over-Ride\"}\n"; + std::string resultPreparedSelect2 = PreparedSelect(client, path, 2, 3, 8); + ASSERT_EQ(resultPreparedSelect2, expectedResultPreparedSelect2); + + std::string expectedResultMultiStep = "{\"season_id\":5,\"episode_id\":1,\"title\":\"Grow Fast or Die Slow\",\"air_date\":17615}\n{\"season_id\":5,\"episode_id\":2,\"title\":\"Reorientation\",\"air_date\":17622}\n{\"season_id\":5,\"episode_id\":3,\"title\":\"Chief Operating Officer\",\"air_date\":17629}\n"; + std::string resultMultiStep = MultiStep(client, path); + ASSERT_EQ(resultMultiStep, expectedResultMultiStep); + + ExplicitTcl(client, path); + + std::string expectedResultPreparedSelect3 = "{\"air_date\":0,\"episode_id\":1,\"season_id\":6,\"series_id\":2,\"title\":\"TBD\"}\n"; + std::string resultPreparedSelect3 = PreparedSelect(client, path, 2, 6, 1); + ASSERT_EQ(resultPreparedSelect3, expectedResultPreparedSelect3); + + std::string expectedResultScanQuerySelect = "{\"series_id\":1,\"season_id\":1,\"title\":\"Season 1\",\"first_aired\":\"2006-02-03\"}\n{\"series_id\":1,\"season_id\":2,\"title\":\"Season 2\",\"first_aired\":\"2007-08-24\"}\n{\"series_id\":1,\"season_id\":3,\"title\":\"Season 3\",\"first_aired\":\"2008-11-21\"}\n{\"series_id\":1,\"season_id\":4,\"title\":\"Season 4\",\"first_aired\":\"2010-06-25\"}\n"; + std::vector resultScanQuerySelectVector = ScanQuerySelect(client, path); + std::string resultScanQuerySelect = std::reduce(resultScanQuerySelectVector.begin(), resultScanQuerySelectVector.end()); + ASSERT_EQ(resultScanQuerySelect, expectedResultScanQuerySelect); + } + catch (const TYdbErrorException& e) { + driver.Stop(true); + FAIL() << "Execution failed due to fatal error:\nStatus: " << ToString(e.Status.GetStatus()) << std::endl << e.Status.GetIssues().ToString(); + } + + driver.Stop(true); +} diff --git a/tests/CMakeLists.txt b/tests/unit/CMakeLists.txt similarity index 100% rename from tests/CMakeLists.txt rename to tests/unit/CMakeLists.txt diff --git a/tests/client/CMakeLists.txt b/tests/unit/client/CMakeLists.txt similarity index 71% rename from tests/client/CMakeLists.txt rename to tests/unit/client/CMakeLists.txt index e5d6d4acfb2..c10b96db557 100644 --- a/tests/client/CMakeLists.txt +++ b/tests/unit/client/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(oauth2_token_exchange) -add_ydb_test(NAME client-ydb_coordination-ut +add_ydb_test(NAME client-ydb_coordination_ut SOURCES coordination_ut.cpp LINK_LIBRARIES @@ -8,9 +8,11 @@ add_ydb_test(NAME client-ydb_coordination-ut cpp-testing-unittest_main YDB-CPP-SDK::Coordination api-grpc + LABELS + unit ) -add_ydb_test(NAME client-extensions-discovery_mutator-ut +add_ydb_test(NAME client-extensions-discovery_mutator_ut SOURCES discovery_mutator_ut.cpp LINK_LIBRARIES @@ -18,9 +20,11 @@ add_ydb_test(NAME client-extensions-discovery_mutator-ut cpp-testing-unittest_main YDB-CPP-SDK::DiscoveryMutator YDB-CPP-SDK::Table + LABELS + unit ) -add_ydb_test(NAME client-ydb_driver-ut +add_ydb_test(NAME client-ydb_driver_ut SOURCES driver_ut.cpp LINK_LIBRARIES @@ -28,9 +32,11 @@ add_ydb_test(NAME client-ydb_driver-ut cpp-testing-unittest_main YDB-CPP-SDK::Driver YDB-CPP-SDK::Table + LABELS + unit ) -add_ydb_test(NAME client-impl-ydb_endpoints-ut +add_ydb_test(NAME client-impl-ydb_endpoints_ut INCLUDE_DIRS ${YDB_SDK_SOURCE_DIR}/src/client/impl/ydb_endpoints SOURCES @@ -39,9 +45,11 @@ add_ydb_test(NAME client-impl-ydb_endpoints-ut yutil cpp-testing-unittest_main client-impl-ydb_endpoints + LABELS + unit ) -add_ydb_test(NAME client-ydb_params-ut +add_ydb_test(NAME client-ydb_params_ut SOURCES params_ut.cpp LINK_LIBRARIES @@ -49,9 +57,11 @@ add_ydb_test(NAME client-ydb_params-ut cpp-testing-unittest_main YDB-CPP-SDK::Params YDB-CPP-SDK::YsonValue + LABELS + unit ) -add_ydb_test(NAME client-ydb_result-ut +add_ydb_test(NAME client-ydb_result_ut SOURCES result_ut.cpp LINK_LIBRARIES @@ -59,9 +69,11 @@ add_ydb_test(NAME client-ydb_result-ut cpp-testing-unittest_main YDB-CPP-SDK::Result YDB-CPP-SDK::Params + LABELS + unit ) -add_ydb_test(NAME client-ydb_value-ut +add_ydb_test(NAME client-ydb_value_ut SOURCES value_ut.cpp LINK_LIBRARIES @@ -71,13 +83,17 @@ add_ydb_test(NAME client-ydb_value-ut YDB-CPP-SDK::JsonValue YDB-CPP-SDK::YsonValue YDB-CPP-SDK::Params + LABELS + unit ) -add_ydb_test(NAME client-draft-ut +add_ydb_test(NAME client-draft_ut SOURCES ydb_scripting_response_headers_ut.cpp LINK_LIBRARIES yutil cpp-testing-unittest_main YDB-CPP-SDK::Draft + LABELS + unit ) diff --git a/tests/client/coordination_ut.cpp b/tests/unit/client/coordination_ut.cpp similarity index 100% rename from tests/client/coordination_ut.cpp rename to tests/unit/client/coordination_ut.cpp diff --git a/tests/client/discovery_mutator_ut.cpp b/tests/unit/client/discovery_mutator_ut.cpp similarity index 100% rename from tests/client/discovery_mutator_ut.cpp rename to tests/unit/client/discovery_mutator_ut.cpp diff --git a/tests/client/driver_ut.cpp b/tests/unit/client/driver_ut.cpp similarity index 100% rename from tests/client/driver_ut.cpp rename to tests/unit/client/driver_ut.cpp diff --git a/tests/client/endpoints_ut.cpp b/tests/unit/client/endpoints_ut.cpp similarity index 100% rename from tests/client/endpoints_ut.cpp rename to tests/unit/client/endpoints_ut.cpp diff --git a/tests/client/oauth2_token_exchange/CMakeLists.txt b/tests/unit/client/oauth2_token_exchange/CMakeLists.txt similarity index 77% rename from tests/client/oauth2_token_exchange/CMakeLists.txt rename to tests/unit/client/oauth2_token_exchange/CMakeLists.txt index a377bf8c809..2e87fb69841 100644 --- a/tests/client/oauth2_token_exchange/CMakeLists.txt +++ b/tests/unit/client/oauth2_token_exchange/CMakeLists.txt @@ -1,4 +1,4 @@ -add_ydb_test(NAME client-oauth2-ut +add_ydb_test(NAME client-oauth2_ut SOURCES credentials_ut.cpp jwt_token_source_ut.cpp @@ -7,4 +7,6 @@ add_ydb_test(NAME client-oauth2-ut cpp-testing-unittest_main library-http-server client-ydb_types-credentials-oauth2 + LABELS + unit ) diff --git a/tests/client/oauth2_token_exchange/credentials_ut.cpp b/tests/unit/client/oauth2_token_exchange/credentials_ut.cpp similarity index 100% rename from tests/client/oauth2_token_exchange/credentials_ut.cpp rename to tests/unit/client/oauth2_token_exchange/credentials_ut.cpp diff --git a/tests/client/oauth2_token_exchange/jwt_token_source_ut.cpp b/tests/unit/client/oauth2_token_exchange/jwt_token_source_ut.cpp similarity index 100% rename from tests/client/oauth2_token_exchange/jwt_token_source_ut.cpp rename to tests/unit/client/oauth2_token_exchange/jwt_token_source_ut.cpp diff --git a/tests/client/params_ut.cpp b/tests/unit/client/params_ut.cpp similarity index 100% rename from tests/client/params_ut.cpp rename to tests/unit/client/params_ut.cpp diff --git a/tests/client/result_ut.cpp b/tests/unit/client/result_ut.cpp similarity index 100% rename from tests/client/result_ut.cpp rename to tests/unit/client/result_ut.cpp diff --git a/tests/client/value_ut.cpp b/tests/unit/client/value_ut.cpp similarity index 100% rename from tests/client/value_ut.cpp rename to tests/unit/client/value_ut.cpp diff --git a/tests/client/ydb_scripting_response_headers_ut.cpp b/tests/unit/client/ydb_scripting_response_headers_ut.cpp similarity index 100% rename from tests/client/ydb_scripting_response_headers_ut.cpp rename to tests/unit/client/ydb_scripting_response_headers_ut.cpp diff --git a/tests/json_value/CMakeLists.txt b/tests/unit/json_value/CMakeLists.txt similarity index 80% rename from tests/json_value/CMakeLists.txt rename to tests/unit/json_value/CMakeLists.txt index 25a4cc4e82b..e5becfaae57 100644 --- a/tests/json_value/CMakeLists.txt +++ b/tests/unit/json_value/CMakeLists.txt @@ -1,4 +1,4 @@ -add_ydb_test(NAME json_value-ut +add_ydb_test(NAME json_value_ut SOURCES ydb_json_value_ut.cpp LINK_LIBRARIES @@ -9,4 +9,6 @@ add_ydb_test(NAME json_value-ut cpp-testing-unittest YDB-CPP-SDK::Proto YDB-CPP-SDK::Params + LABELS + unit ) diff --git a/tests/json_value/ydb_json_value_ut.cpp b/tests/unit/json_value/ydb_json_value_ut.cpp similarity index 100% rename from tests/json_value/ydb_json_value_ut.cpp rename to tests/unit/json_value/ydb_json_value_ut.cpp diff --git a/tests/library/CMakeLists.txt b/tests/unit/library/CMakeLists.txt similarity index 100% rename from tests/library/CMakeLists.txt rename to tests/unit/library/CMakeLists.txt diff --git a/tests/library/cache/CMakeLists.txt b/tests/unit/library/cache/CMakeLists.txt similarity index 85% rename from tests/library/cache/CMakeLists.txt rename to tests/unit/library/cache/CMakeLists.txt index be659e273dc..ff74a781be7 100644 --- a/tests/library/cache/CMakeLists.txt +++ b/tests/unit/library/cache/CMakeLists.txt @@ -5,4 +5,6 @@ add_ydb_test(NAME cache-cache_ut yutil cpp-testing-unittest_main library-cache + LABELS + unit ) \ No newline at end of file diff --git a/tests/library/cache/cache_ut.cpp b/tests/unit/library/cache/cache_ut.cpp similarity index 100% rename from tests/library/cache/cache_ut.cpp rename to tests/unit/library/cache/cache_ut.cpp diff --git a/tests/library/case_insensitive_string/CMakeLists.txt b/tests/unit/library/case_insensitive_string/CMakeLists.txt similarity index 93% rename from tests/library/case_insensitive_string/CMakeLists.txt rename to tests/unit/library/case_insensitive_string/CMakeLists.txt index 85dd71d3cff..06280932a5c 100644 --- a/tests/library/case_insensitive_string/CMakeLists.txt +++ b/tests/unit/library/case_insensitive_string/CMakeLists.txt @@ -6,4 +6,6 @@ add_ydb_test(NAME library-case_insensitive_string_ut LINK_LIBRARIES library-case_insensitive_string cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/case_insensitive_string/case_insensitive_string_ut.cpp b/tests/unit/library/case_insensitive_string/case_insensitive_string_ut.cpp similarity index 100% rename from tests/library/case_insensitive_string/case_insensitive_string_ut.cpp rename to tests/unit/library/case_insensitive_string/case_insensitive_string_ut.cpp diff --git a/tests/library/cgiparam/CMakeLists.txt b/tests/unit/library/cgiparam/CMakeLists.txt similarity index 61% rename from tests/library/cgiparam/CMakeLists.txt rename to tests/unit/library/cgiparam/CMakeLists.txt index 8092f166649..dab54cba6b4 100644 --- a/tests/library/cgiparam/CMakeLists.txt +++ b/tests/unit/library/cgiparam/CMakeLists.txt @@ -1,7 +1,9 @@ -add_ydb_test(NAME library-cgiparam-ut +add_ydb_test(NAME library-cgiparam_ut SOURCES ut.cpp LINK_LIBRARIES library-cgiparam cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/cgiparam/ut.cpp b/tests/unit/library/cgiparam/ut.cpp similarity index 100% rename from tests/library/cgiparam/ut.cpp rename to tests/unit/library/cgiparam/ut.cpp diff --git a/tests/library/charset/CMakeLists.txt b/tests/unit/library/charset/CMakeLists.txt similarity index 91% rename from tests/library/charset/CMakeLists.txt rename to tests/unit/library/charset/CMakeLists.txt index 437b4144b4b..ea7c0752686 100644 --- a/tests/library/charset/CMakeLists.txt +++ b/tests/unit/library/charset/CMakeLists.txt @@ -6,6 +6,8 @@ add_ydb_test(NAME library-charset-ci_string_ut LINK_LIBRARIES library-charset-lite cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME library-charset-codepage_ut @@ -16,6 +18,8 @@ add_ydb_test(NAME library-charset-codepage_ut LINK_LIBRARIES library-charset cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME library-charset-iconv_ut @@ -26,6 +30,8 @@ add_ydb_test(NAME library-charset-iconv_ut LINK_LIBRARIES library-charset cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME library-charset-recyr_int_ut @@ -36,6 +42,8 @@ add_ydb_test(NAME library-charset-recyr_int_ut LINK_LIBRARIES library-charset cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME library-charset-wide_ut @@ -46,4 +54,6 @@ add_ydb_test(NAME library-charset-wide_ut LINK_LIBRARIES library-charset cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/charset/ci_string_ut.cpp b/tests/unit/library/charset/ci_string_ut.cpp similarity index 100% rename from tests/library/charset/ci_string_ut.cpp rename to tests/unit/library/charset/ci_string_ut.cpp diff --git a/tests/library/charset/codepage_ut.cpp b/tests/unit/library/charset/codepage_ut.cpp similarity index 100% rename from tests/library/charset/codepage_ut.cpp rename to tests/unit/library/charset/codepage_ut.cpp diff --git a/tests/library/charset/iconv_ut.cpp b/tests/unit/library/charset/iconv_ut.cpp similarity index 100% rename from tests/library/charset/iconv_ut.cpp rename to tests/unit/library/charset/iconv_ut.cpp diff --git a/tests/library/charset/recyr_int_ut.cpp b/tests/unit/library/charset/recyr_int_ut.cpp similarity index 100% rename from tests/library/charset/recyr_int_ut.cpp rename to tests/unit/library/charset/recyr_int_ut.cpp diff --git a/tests/library/charset/wide_ut.cpp b/tests/unit/library/charset/wide_ut.cpp similarity index 100% rename from tests/library/charset/wide_ut.cpp rename to tests/unit/library/charset/wide_ut.cpp diff --git a/tests/library/containers/CMakeLists.txt b/tests/unit/library/containers/CMakeLists.txt similarity index 92% rename from tests/library/containers/CMakeLists.txt rename to tests/unit/library/containers/CMakeLists.txt index 0c1dad4287c..4a072f88c8f 100644 --- a/tests/library/containers/CMakeLists.txt +++ b/tests/unit/library/containers/CMakeLists.txt @@ -6,6 +6,8 @@ add_ydb_test(NAME library-containers-disjoint_interval_tree_ut LINK_LIBRARIES containers-disjoint_interval_tree cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME library-containers-intrusive_rb_tree_ut @@ -16,6 +18,8 @@ add_ydb_test(NAME library-containers-intrusive_rb_tree_ut LINK_LIBRARIES containers-intrusive_rb_tree cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME library-containers-paged_vector_ut @@ -26,6 +30,8 @@ add_ydb_test(NAME library-containers-paged_vector_ut LINK_LIBRARIES containers-paged_vector cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME library-containers-stack_vector_ut @@ -34,4 +40,6 @@ add_ydb_test(NAME library-containers-stack_vector_ut LINK_LIBRARIES containers-stack_vector cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/containers/disjoint_interval_tree_ut.cpp b/tests/unit/library/containers/disjoint_interval_tree_ut.cpp similarity index 100% rename from tests/library/containers/disjoint_interval_tree_ut.cpp rename to tests/unit/library/containers/disjoint_interval_tree_ut.cpp diff --git a/tests/library/containers/intrusive_rb_tree_ut.cpp b/tests/unit/library/containers/intrusive_rb_tree_ut.cpp similarity index 100% rename from tests/library/containers/intrusive_rb_tree_ut.cpp rename to tests/unit/library/containers/intrusive_rb_tree_ut.cpp diff --git a/tests/library/containers/paged_vector_ut.cpp b/tests/unit/library/containers/paged_vector_ut.cpp similarity index 100% rename from tests/library/containers/paged_vector_ut.cpp rename to tests/unit/library/containers/paged_vector_ut.cpp diff --git a/tests/library/containers/stack_vector_ut.cpp b/tests/unit/library/containers/stack_vector_ut.cpp similarity index 100% rename from tests/library/containers/stack_vector_ut.cpp rename to tests/unit/library/containers/stack_vector_ut.cpp diff --git a/tests/library/coroutine/CMakeLists.txt b/tests/unit/library/coroutine/CMakeLists.txt similarity index 100% rename from tests/library/coroutine/CMakeLists.txt rename to tests/unit/library/coroutine/CMakeLists.txt diff --git a/tests/library/coroutine/engine/CMakeLists.txt b/tests/unit/library/coroutine/engine/CMakeLists.txt similarity index 93% rename from tests/library/coroutine/engine/CMakeLists.txt rename to tests/unit/library/coroutine/engine/CMakeLists.txt index ce3281b6462..e8ec7822187 100644 --- a/tests/library/coroutine/engine/CMakeLists.txt +++ b/tests/unit/library/coroutine/engine/CMakeLists.txt @@ -6,6 +6,8 @@ add_ydb_test(NAME library-coroutine-engine-coroutine_ut LINK_LIBRARIES library-coroutine-engine cpp-testing-unittest_main + LABELS + unit ) add_subdirectory(stack) diff --git a/tests/library/coroutine/engine/coroutine_ut.cpp b/tests/unit/library/coroutine/engine/coroutine_ut.cpp similarity index 100% rename from tests/library/coroutine/engine/coroutine_ut.cpp rename to tests/unit/library/coroutine/engine/coroutine_ut.cpp diff --git a/tests/library/coroutine/engine/stack/CMakeLists.txt b/tests/unit/library/coroutine/engine/stack/CMakeLists.txt similarity index 93% rename from tests/library/coroutine/engine/stack/CMakeLists.txt rename to tests/unit/library/coroutine/engine/stack/CMakeLists.txt index 93b7dbacd97..03ed5f9c409 100644 --- a/tests/library/coroutine/engine/stack/CMakeLists.txt +++ b/tests/unit/library/coroutine/engine/stack/CMakeLists.txt @@ -6,6 +6,8 @@ add_ydb_test(NAME library-coroutine-engine-stack-stack_allocator_ut LINK_LIBRARIES library-coroutine-engine cpp-testing-gtest_main + LABELS + unit ) add_ydb_test(NAME library-coroutine-engine-stack-stack_guards_ut @@ -16,6 +18,8 @@ add_ydb_test(NAME library-coroutine-engine-stack-stack_guards_ut LINK_LIBRARIES library-coroutine-engine cpp-testing-gtest_main + LABELS + unit ) add_ydb_test(NAME library-coroutine-engine-stack-stack_pool_ut @@ -26,6 +30,8 @@ add_ydb_test(NAME library-coroutine-engine-stack-stack_pool_ut LINK_LIBRARIES library-coroutine-engine cpp-testing-gtest_main + LABELS + unit ) add_ydb_test(NAME library-coroutine-engine-stack-stack_ut @@ -36,6 +42,8 @@ add_ydb_test(NAME library-coroutine-engine-stack-stack_ut LINK_LIBRARIES library-coroutine-engine cpp-testing-gtest_main + LABELS + unit ) add_ydb_test(NAME library-coroutine-engine-stack-stack_utils_ut @@ -46,4 +54,6 @@ add_ydb_test(NAME library-coroutine-engine-stack-stack_utils_ut LINK_LIBRARIES library-coroutine-engine cpp-testing-gtest_main + LABELS + unit ) diff --git a/tests/library/coroutine/engine/stack/stack_allocator_ut.cpp b/tests/unit/library/coroutine/engine/stack/stack_allocator_ut.cpp similarity index 100% rename from tests/library/coroutine/engine/stack/stack_allocator_ut.cpp rename to tests/unit/library/coroutine/engine/stack/stack_allocator_ut.cpp diff --git a/tests/library/coroutine/engine/stack/stack_guards_ut.cpp b/tests/unit/library/coroutine/engine/stack/stack_guards_ut.cpp similarity index 100% rename from tests/library/coroutine/engine/stack/stack_guards_ut.cpp rename to tests/unit/library/coroutine/engine/stack/stack_guards_ut.cpp diff --git a/tests/library/coroutine/engine/stack/stack_pool_ut.cpp b/tests/unit/library/coroutine/engine/stack/stack_pool_ut.cpp similarity index 100% rename from tests/library/coroutine/engine/stack/stack_pool_ut.cpp rename to tests/unit/library/coroutine/engine/stack/stack_pool_ut.cpp diff --git a/tests/library/coroutine/engine/stack/stack_ut.cpp b/tests/unit/library/coroutine/engine/stack/stack_ut.cpp similarity index 100% rename from tests/library/coroutine/engine/stack/stack_ut.cpp rename to tests/unit/library/coroutine/engine/stack/stack_ut.cpp diff --git a/tests/library/coroutine/engine/stack/stack_utils_ut.cpp b/tests/unit/library/coroutine/engine/stack/stack_utils_ut.cpp similarity index 100% rename from tests/library/coroutine/engine/stack/stack_utils_ut.cpp rename to tests/unit/library/coroutine/engine/stack/stack_utils_ut.cpp diff --git a/tests/library/dbg_output/CMakeLists.txt b/tests/unit/library/dbg_output/CMakeLists.txt similarity index 94% rename from tests/library/dbg_output/CMakeLists.txt rename to tests/unit/library/dbg_output/CMakeLists.txt index 281a021e12b..ffdaf1d972f 100644 --- a/tests/library/dbg_output/CMakeLists.txt +++ b/tests/unit/library/dbg_output/CMakeLists.txt @@ -8,4 +8,6 @@ add_ydb_test(NAME library-dbg_output-dbg_output_ut yutil library-dbg_output cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/dbg_output/dbg_output_ut.cpp b/tests/unit/library/dbg_output/dbg_output_ut.cpp similarity index 100% rename from tests/library/dbg_output/dbg_output_ut.cpp rename to tests/unit/library/dbg_output/dbg_output_ut.cpp diff --git a/tests/library/diff/CMakeLists.txt b/tests/unit/library/diff/CMakeLists.txt similarity index 73% rename from tests/library/diff/CMakeLists.txt rename to tests/unit/library/diff/CMakeLists.txt index 81aa105a91a..82c1e415c8a 100644 --- a/tests/library/diff/CMakeLists.txt +++ b/tests/unit/library/diff/CMakeLists.txt @@ -1,4 +1,4 @@ -add_ydb_test(NAME library-diff-ut +add_ydb_test(NAME library-diff_ut SOURCES ut.cpp INCLUDE_DIRS @@ -6,4 +6,6 @@ add_ydb_test(NAME library-diff-ut LINK_LIBRARIES library-diff cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/diff/ut.cpp b/tests/unit/library/diff/ut.cpp similarity index 100% rename from tests/library/diff/ut.cpp rename to tests/unit/library/diff/ut.cpp diff --git a/tests/library/digest/CMakeLists.txt b/tests/unit/library/digest/CMakeLists.txt similarity index 100% rename from tests/library/digest/CMakeLists.txt rename to tests/unit/library/digest/CMakeLists.txt diff --git a/tests/library/digest/lower_case/CMakeLists.txt b/tests/unit/library/digest/lower_case/CMakeLists.txt similarity index 92% rename from tests/library/digest/lower_case/CMakeLists.txt rename to tests/unit/library/digest/lower_case/CMakeLists.txt index 537f45deba0..a7157c5373b 100644 --- a/tests/library/digest/lower_case/CMakeLists.txt +++ b/tests/unit/library/digest/lower_case/CMakeLists.txt @@ -6,6 +6,8 @@ add_ydb_test(NAME library-digest-lower_case-hash_ops_ut LINK_LIBRARIES digest-lower_case cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME library-digest-lower_case-lchash_ut @@ -16,4 +18,6 @@ add_ydb_test(NAME library-digest-lower_case-lchash_ut LINK_LIBRARIES digest-lower_case cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/digest/lower_case/hash_ops_ut.cpp b/tests/unit/library/digest/lower_case/hash_ops_ut.cpp similarity index 100% rename from tests/library/digest/lower_case/hash_ops_ut.cpp rename to tests/unit/library/digest/lower_case/hash_ops_ut.cpp diff --git a/tests/library/digest/lower_case/lchash_ut.cpp b/tests/unit/library/digest/lower_case/lchash_ut.cpp similarity index 100% rename from tests/library/digest/lower_case/lchash_ut.cpp rename to tests/unit/library/digest/lower_case/lchash_ut.cpp diff --git a/tests/library/digest/md5/CMakeLists.txt b/tests/unit/library/digest/md5/CMakeLists.txt similarity index 93% rename from tests/library/digest/md5/CMakeLists.txt rename to tests/unit/library/digest/md5/CMakeLists.txt index 57f0574b034..a1b10c30d1e 100644 --- a/tests/library/digest/md5/CMakeLists.txt +++ b/tests/unit/library/digest/md5/CMakeLists.txt @@ -8,6 +8,8 @@ add_ydb_test(NAME library-digest-md5_medium_ut yutil digest-md5 cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME library-digest-md5_ut @@ -20,4 +22,6 @@ add_ydb_test(NAME library-digest-md5_ut yutil digest-md5 cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/digest/md5/md5_medium_ut.cpp b/tests/unit/library/digest/md5/md5_medium_ut.cpp similarity index 100% rename from tests/library/digest/md5/md5_medium_ut.cpp rename to tests/unit/library/digest/md5/md5_medium_ut.cpp diff --git a/tests/library/digest/md5/md5_ut.cpp b/tests/unit/library/digest/md5/md5_ut.cpp similarity index 100% rename from tests/library/digest/md5/md5_ut.cpp rename to tests/unit/library/digest/md5/md5_ut.cpp diff --git a/tests/library/digest/murmur/CMakeLists.txt b/tests/unit/library/digest/murmur/CMakeLists.txt similarity index 71% rename from tests/library/digest/murmur/CMakeLists.txt rename to tests/unit/library/digest/murmur/CMakeLists.txt index 43226ad4d12..30c6ea9bd65 100644 --- a/tests/library/digest/murmur/CMakeLists.txt +++ b/tests/unit/library/digest/murmur/CMakeLists.txt @@ -1,4 +1,4 @@ -add_ydb_test(NAME library-digest-murmur-ut +add_ydb_test(NAME library-digest-murmur_ut SOURCES ut.cpp INCLUDE_DIRS @@ -6,4 +6,6 @@ add_ydb_test(NAME library-digest-murmur-ut LINK_LIBRARIES digest-murmur cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/digest/murmur/ut.cpp b/tests/unit/library/digest/murmur/ut.cpp similarity index 100% rename from tests/library/digest/murmur/ut.cpp rename to tests/unit/library/digest/murmur/ut.cpp diff --git a/tests/library/json/CMakeLists.txt b/tests/unit/library/json/CMakeLists.txt similarity index 91% rename from tests/library/json/CMakeLists.txt rename to tests/unit/library/json/CMakeLists.txt index 9f9a916d92e..134083b49c7 100644 --- a/tests/library/json/CMakeLists.txt +++ b/tests/unit/library/json/CMakeLists.txt @@ -10,6 +10,8 @@ LINK_LIBRARIES yutil cpp-testing-unittest_main library-json +LABELS + unit ) add_ydb_test(NAME json-ut-json_reader_fast_ut @@ -25,6 +27,8 @@ LINK_LIBRARIES yutil cpp-testing-unittest_main library-json +LABELS + unit ) add_ydb_test(NAME json-ut-json_reader_ut @@ -39,6 +43,8 @@ LINK_LIBRARIES yutil cpp-testing-unittest_main library-json +LABELS + unit ) add_ydb_test(NAME json-ut-json_saveload_ut @@ -53,6 +59,8 @@ LINK_LIBRARIES yutil cpp-testing-unittest_main library-json +LABELS + unit ) add_ydb_test(NAME json-ut-json_writer_ut @@ -66,4 +74,6 @@ LINK_LIBRARIES yutil cpp-testing-unittest_main library-json +LABELS + unit ) diff --git a/tests/library/json/json_prettifier_ut.cpp b/tests/unit/library/json/json_prettifier_ut.cpp similarity index 100% rename from tests/library/json/json_prettifier_ut.cpp rename to tests/unit/library/json/json_prettifier_ut.cpp diff --git a/tests/library/json/json_reader_fast_ut.cpp b/tests/unit/library/json/json_reader_fast_ut.cpp similarity index 100% rename from tests/library/json/json_reader_fast_ut.cpp rename to tests/unit/library/json/json_reader_fast_ut.cpp diff --git a/tests/library/json/json_reader_ut.cpp b/tests/unit/library/json/json_reader_ut.cpp similarity index 100% rename from tests/library/json/json_reader_ut.cpp rename to tests/unit/library/json/json_reader_ut.cpp diff --git a/tests/library/json/json_saveload_ut.cpp b/tests/unit/library/json/json_saveload_ut.cpp similarity index 100% rename from tests/library/json/json_saveload_ut.cpp rename to tests/unit/library/json/json_saveload_ut.cpp diff --git a/tests/library/json/json_writer_ut.cpp b/tests/unit/library/json/json_writer_ut.cpp similarity index 100% rename from tests/library/json/json_writer_ut.cpp rename to tests/unit/library/json/json_writer_ut.cpp diff --git a/tests/library/json/writer/CMakeLists.txt b/tests/unit/library/json/writer/CMakeLists.txt similarity index 92% rename from tests/library/json/writer/CMakeLists.txt rename to tests/unit/library/json/writer/CMakeLists.txt index 24ee63e3899..511da59f136 100644 --- a/tests/library/json/writer/CMakeLists.txt +++ b/tests/unit/library/json/writer/CMakeLists.txt @@ -10,6 +10,8 @@ LINK_LIBRARIES yutil library-json-writer cpp-testing-unittest_main +LABELS + unit ) add_ydb_test(NAME library-json-writer-json_value_ut @@ -23,4 +25,6 @@ LINK_LIBRARIES yutil library-json-writer cpp-testing-unittest_main +LABELS + unit ) diff --git a/tests/library/json/writer/json_ut.cpp b/tests/unit/library/json/writer/json_ut.cpp similarity index 100% rename from tests/library/json/writer/json_ut.cpp rename to tests/unit/library/json/writer/json_ut.cpp diff --git a/tests/library/json/writer/json_value_ut.cpp b/tests/unit/library/json/writer/json_value_ut.cpp similarity index 100% rename from tests/library/json/writer/json_value_ut.cpp rename to tests/unit/library/json/writer/json_value_ut.cpp diff --git a/tests/library/operation_id/CMakeLists.txt b/tests/unit/library/operation_id/CMakeLists.txt similarity index 72% rename from tests/library/operation_id/CMakeLists.txt rename to tests/unit/library/operation_id/CMakeLists.txt index aba6fe8c745..d034531ad88 100644 --- a/tests/library/operation_id/CMakeLists.txt +++ b/tests/unit/library/operation_id/CMakeLists.txt @@ -1,4 +1,4 @@ -add_ydb_test(NAME operation_id-ut +add_ydb_test(NAME operation_id_ut SOURCES operation_id_ut.cpp LINK_LIBRARIES @@ -6,4 +6,6 @@ add_ydb_test(NAME operation_id-ut cpp-testing-unittest_main library-operation_id cpp-testing-unittest + LABELS + unit ) diff --git a/tests/library/operation_id/operation_id_ut.cpp b/tests/unit/library/operation_id/operation_id_ut.cpp similarity index 100% rename from tests/library/operation_id/operation_id_ut.cpp rename to tests/unit/library/operation_id/operation_id_ut.cpp diff --git a/tests/library/testing/CMakeLists.txt b/tests/unit/library/testing/CMakeLists.txt similarity index 100% rename from tests/library/testing/CMakeLists.txt rename to tests/unit/library/testing/CMakeLists.txt diff --git a/tests/library/testing/common/CMakeLists.txt b/tests/unit/library/testing/common/CMakeLists.txt similarity index 89% rename from tests/library/testing/common/CMakeLists.txt rename to tests/unit/library/testing/common/CMakeLists.txt index 20c847707b4..bb1b8803081 100644 --- a/tests/library/testing/common/CMakeLists.txt +++ b/tests/unit/library/testing/common/CMakeLists.txt @@ -5,4 +5,6 @@ add_ydb_test(NAME cpp-testing-common_ut scope_ut.cpp LINK_LIBRARIES cpp-testing-gtest_main + LABELS + unit ) diff --git a/tests/library/testing/common/env_ut.cpp b/tests/unit/library/testing/common/env_ut.cpp similarity index 98% rename from tests/library/testing/common/env_ut.cpp rename to tests/unit/library/testing/common/env_ut.cpp index 7a643ac9a68..e6d316aa48d 100644 --- a/tests/library/testing/common/env_ut.cpp +++ b/tests/unit/library/testing/common/env_ut.cpp @@ -41,7 +41,7 @@ TEST(Runtime, BuildRoot) { TEST(Runtime, BinaryPath) { NTesting::TScopedEnvironment contextGuard("YA_TEST_CONTEXT_FILE", ""); // remove context filename Singleton()->ReInitialize(); - EXPECT_TRUE(TFsPath(BinaryPath("tests/library/testing/common")).Exists()); + EXPECT_TRUE(TFsPath(BinaryPath("tests/unit/library/testing/common")).Exists()); } TEST(Runtime, GetArcadiaTestsData) { diff --git a/tests/library/testing/common/network_ut.cpp b/tests/unit/library/testing/common/network_ut.cpp similarity index 100% rename from tests/library/testing/common/network_ut.cpp rename to tests/unit/library/testing/common/network_ut.cpp diff --git a/tests/library/testing/common/scope_ut.cpp b/tests/unit/library/testing/common/scope_ut.cpp similarity index 100% rename from tests/library/testing/common/scope_ut.cpp rename to tests/unit/library/testing/common/scope_ut.cpp diff --git a/tests/library/testing/gmock_in_unittest/CMakeLists.txt b/tests/unit/library/testing/gmock_in_unittest/CMakeLists.txt similarity index 90% rename from tests/library/testing/gmock_in_unittest/CMakeLists.txt rename to tests/unit/library/testing/gmock_in_unittest/CMakeLists.txt index e2918194e99..0c86f1ffc09 100644 --- a/tests/library/testing/gmock_in_unittest/CMakeLists.txt +++ b/tests/unit/library/testing/gmock_in_unittest/CMakeLists.txt @@ -4,4 +4,6 @@ add_ydb_test(NAME cpp-testing-gmock_in_unittest_ut LINK_LIBRARIES cpp-testing-gmock_in_unittest cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/testing/gmock_in_unittest/example_ut.cpp b/tests/unit/library/testing/gmock_in_unittest/example_ut.cpp similarity index 100% rename from tests/library/testing/gmock_in_unittest/example_ut.cpp rename to tests/unit/library/testing/gmock_in_unittest/example_ut.cpp diff --git a/tests/library/testing/gtest/CMakeLists.txt b/tests/unit/library/testing/gtest/CMakeLists.txt similarity index 88% rename from tests/library/testing/gtest/CMakeLists.txt rename to tests/unit/library/testing/gtest/CMakeLists.txt index 746cddfdad6..e6b1fd3fe36 100644 --- a/tests/library/testing/gtest/CMakeLists.txt +++ b/tests/unit/library/testing/gtest/CMakeLists.txt @@ -4,4 +4,6 @@ add_ydb_test(NAME cpp-testing-gtest_ut ut.cpp LINK_LIBRARIES cpp-testing-gtest_main + LABELS + unit ) diff --git a/tests/library/testing/gtest/README.md b/tests/unit/library/testing/gtest/README.md similarity index 100% rename from tests/library/testing/gtest/README.md rename to tests/unit/library/testing/gtest/README.md diff --git a/tests/library/testing/gtest/golden/data.txt b/tests/unit/library/testing/gtest/golden/data.txt similarity index 100% rename from tests/library/testing/gtest/golden/data.txt rename to tests/unit/library/testing/gtest/golden/data.txt diff --git a/tests/library/testing/gtest/matchers_ut.cpp b/tests/unit/library/testing/gtest/matchers_ut.cpp similarity index 100% rename from tests/library/testing/gtest/matchers_ut.cpp rename to tests/unit/library/testing/gtest/matchers_ut.cpp diff --git a/tests/library/testing/gtest/ut.cpp b/tests/unit/library/testing/gtest/ut.cpp similarity index 100% rename from tests/library/testing/gtest/ut.cpp rename to tests/unit/library/testing/gtest/ut.cpp diff --git a/tests/library/testing/gtest_extensions/CMakeLists.txt b/tests/unit/library/testing/gtest_extensions/CMakeLists.txt similarity index 90% rename from tests/library/testing/gtest_extensions/CMakeLists.txt rename to tests/unit/library/testing/gtest_extensions/CMakeLists.txt index 94f82c25906..9c477ee568a 100644 --- a/tests/library/testing/gtest_extensions/CMakeLists.txt +++ b/tests/unit/library/testing/gtest_extensions/CMakeLists.txt @@ -4,4 +4,6 @@ add_ydb_test(NAME cpp-testing-gtest_extensions_ut probe_ut.cpp LINK_LIBRARIES cpp-testing-gtest_main + LABELS + unit ) diff --git a/tests/library/testing/gtest_extensions/README.md b/tests/unit/library/testing/gtest_extensions/README.md similarity index 100% rename from tests/library/testing/gtest_extensions/README.md rename to tests/unit/library/testing/gtest_extensions/README.md diff --git a/tests/library/testing/gtest_extensions/gtest_extensions_ut.cpp b/tests/unit/library/testing/gtest_extensions/gtest_extensions_ut.cpp similarity index 100% rename from tests/library/testing/gtest_extensions/gtest_extensions_ut.cpp rename to tests/unit/library/testing/gtest_extensions/gtest_extensions_ut.cpp diff --git a/tests/library/testing/gtest_extensions/probe_ut.cpp b/tests/unit/library/testing/gtest_extensions/probe_ut.cpp similarity index 100% rename from tests/library/testing/gtest_extensions/probe_ut.cpp rename to tests/unit/library/testing/gtest_extensions/probe_ut.cpp diff --git a/tests/library/testing/unittest/CMakeLists.txt b/tests/unit/library/testing/unittest/CMakeLists.txt similarity index 71% rename from tests/library/testing/unittest/CMakeLists.txt rename to tests/unit/library/testing/unittest/CMakeLists.txt index 3075f16e0c3..c4e5e252acc 100644 --- a/tests/library/testing/unittest/CMakeLists.txt +++ b/tests/unit/library/testing/unittest/CMakeLists.txt @@ -3,11 +3,15 @@ add_ydb_test(NAME cpp-testing-unittest_ut main.cpp LINK_LIBRARIES cpp-testing-unittest_main + LABELS + unit ) -add_ydb_test(NAME cpp-testing-unittest_fat +add_ydb_test(NAME cpp-testing-unittest_fat_ut SOURCES test_port_manager.cpp LINK_LIBRARIES cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/library/testing/unittest/main.cpp b/tests/unit/library/testing/unittest/main.cpp similarity index 100% rename from tests/library/testing/unittest/main.cpp rename to tests/unit/library/testing/unittest/main.cpp diff --git a/tests/library/testing/unittest/test_port_manager.cpp b/tests/unit/library/testing/unittest/test_port_manager.cpp similarity index 100% rename from tests/library/testing/unittest/test_port_manager.cpp rename to tests/unit/library/testing/unittest/test_port_manager.cpp diff --git a/tests/library/yql/CMakeLists.txt b/tests/unit/library/yql/CMakeLists.txt similarity index 79% rename from tests/library/yql/CMakeLists.txt rename to tests/unit/library/yql/CMakeLists.txt index 7ded65d3897..a124b7c860e 100644 --- a/tests/library/yql/CMakeLists.txt +++ b/tests/unit/library/yql/CMakeLists.txt @@ -1,13 +1,15 @@ -add_ydb_test(NAME yql-utils-ut +add_ydb_test(NAME yql-utils_ut SOURCES utf8_ut.cpp LINK_LIBRARIES yutil cpp-testing-unittest_main yql-utils + LABELS + unit ) -add_ydb_test(NAME yql-public-issue-ut +add_ydb_test(NAME yql-public-issue_ut SOURCES yql_issue_ut.cpp LINK_LIBRARIES @@ -15,6 +17,8 @@ add_ydb_test(NAME yql-public-issue-ut cpp-testing-unittest_main yql-public-issue unicode_normalization + LABELS + unit ) add_ydb_test(NAME yql-public-decimal_ut @@ -24,6 +28,8 @@ add_ydb_test(NAME yql-public-decimal_ut yutil cpp-testing-unittest_main yql-public-decimal + LABELS + unit ) add_ydb_test(NAME yql-public-wide_int_ut @@ -33,4 +39,6 @@ add_ydb_test(NAME yql-public-wide_int_ut yutil cpp-testing-unittest_main yql-public-decimal + LABELS + unit ) diff --git a/tests/library/yql/utf8_ut.cpp b/tests/unit/library/yql/utf8_ut.cpp similarity index 100% rename from tests/library/yql/utf8_ut.cpp rename to tests/unit/library/yql/utf8_ut.cpp diff --git a/tests/library/yql/yql_decimal_ut.cpp b/tests/unit/library/yql/yql_decimal_ut.cpp similarity index 100% rename from tests/library/yql/yql_decimal_ut.cpp rename to tests/unit/library/yql/yql_decimal_ut.cpp diff --git a/tests/library/yql/yql_issue_ut.cpp b/tests/unit/library/yql/yql_issue_ut.cpp similarity index 100% rename from tests/library/yql/yql_issue_ut.cpp rename to tests/unit/library/yql/yql_issue_ut.cpp diff --git a/tests/library/yql/yql_wide_int_ut.cpp b/tests/unit/library/yql/yql_wide_int_ut.cpp similarity index 100% rename from tests/library/yql/yql_wide_int_ut.cpp rename to tests/unit/library/yql/yql_wide_int_ut.cpp diff --git a/tests/util/CMakeLists.txt b/tests/unit/util/CMakeLists.txt similarity index 100% rename from tests/util/CMakeLists.txt rename to tests/unit/util/CMakeLists.txt diff --git a/tests/util/charset/CMakeLists.txt b/tests/unit/util/charset/CMakeLists.txt similarity index 91% rename from tests/util/charset/CMakeLists.txt rename to tests/unit/util/charset/CMakeLists.txt index 75d6027ea2e..1696fa35867 100644 --- a/tests/util/charset/CMakeLists.txt +++ b/tests/unit/util/charset/CMakeLists.txt @@ -6,6 +6,8 @@ add_ydb_test(NAME util-charset-utf8_ut LINK_LIBRARIES util-charset cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-charset-wide_ut @@ -16,4 +18,6 @@ add_ydb_test(NAME util-charset-wide_ut LINK_LIBRARIES util-charset cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/util/charset/data/invalid_UTF8.bin b/tests/unit/util/charset/data/invalid_UTF8.bin similarity index 100% rename from tests/util/charset/data/invalid_UTF8.bin rename to tests/unit/util/charset/data/invalid_UTF8.bin diff --git a/tests/util/charset/data/test1.txt b/tests/unit/util/charset/data/test1.txt similarity index 100% rename from tests/util/charset/data/test1.txt rename to tests/unit/util/charset/data/test1.txt diff --git a/tests/util/charset/utf8_ut.cpp b/tests/unit/util/charset/utf8_ut.cpp similarity index 100% rename from tests/util/charset/utf8_ut.cpp rename to tests/unit/util/charset/utf8_ut.cpp diff --git a/tests/util/charset/wide_ut.cpp b/tests/unit/util/charset/wide_ut.cpp similarity index 100% rename from tests/util/charset/wide_ut.cpp rename to tests/unit/util/charset/wide_ut.cpp diff --git a/tests/util/digest/CMakeLists.txt b/tests/unit/util/digest/CMakeLists.txt similarity index 89% rename from tests/util/digest/CMakeLists.txt rename to tests/unit/util/digest/CMakeLists.txt index 8101b1c26ef..b0e51b54d81 100644 --- a/tests/util/digest/CMakeLists.txt +++ b/tests/unit/util/digest/CMakeLists.txt @@ -6,6 +6,8 @@ add_ydb_test(NAME util-digest-city_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-digest-fnv_ut @@ -16,6 +18,8 @@ add_ydb_test(NAME util-digest-fnv_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-digest-multi_ut @@ -24,6 +28,8 @@ add_ydb_test(NAME util-digest-multi_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-digest-murmur_ut @@ -34,6 +40,8 @@ add_ydb_test(NAME util-digest-murmur_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-digest-sequence_ut @@ -42,4 +50,6 @@ add_ydb_test(NAME util-digest-sequence_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/util/digest/city_ut.cpp b/tests/unit/util/digest/city_ut.cpp similarity index 100% rename from tests/util/digest/city_ut.cpp rename to tests/unit/util/digest/city_ut.cpp diff --git a/tests/util/digest/fnv_ut.cpp b/tests/unit/util/digest/fnv_ut.cpp similarity index 100% rename from tests/util/digest/fnv_ut.cpp rename to tests/unit/util/digest/fnv_ut.cpp diff --git a/tests/util/digest/multi_ut.cpp b/tests/unit/util/digest/multi_ut.cpp similarity index 100% rename from tests/util/digest/multi_ut.cpp rename to tests/unit/util/digest/multi_ut.cpp diff --git a/tests/util/digest/murmur_ut.cpp b/tests/unit/util/digest/murmur_ut.cpp similarity index 100% rename from tests/util/digest/murmur_ut.cpp rename to tests/unit/util/digest/murmur_ut.cpp diff --git a/tests/util/digest/sequence_ut.cpp b/tests/unit/util/digest/sequence_ut.cpp similarity index 100% rename from tests/util/digest/sequence_ut.cpp rename to tests/unit/util/digest/sequence_ut.cpp diff --git a/tests/util/folder/CMakeLists.txt b/tests/unit/util/folder/CMakeLists.txt similarity index 91% rename from tests/util/folder/CMakeLists.txt rename to tests/unit/util/folder/CMakeLists.txt index 16d7478dd33..85325841ac1 100644 --- a/tests/util/folder/CMakeLists.txt +++ b/tests/unit/util/folder/CMakeLists.txt @@ -6,6 +6,8 @@ add_ydb_test(NAME util-folder-dirut_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-folder-filelist_ut @@ -16,6 +18,8 @@ add_ydb_test(NAME util-folder-filelist_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-folder-fts_ut @@ -27,6 +31,8 @@ add_ydb_test(NAME util-folder-fts_ut yutil cpp-testing-unittest_main threading-future + LABELS + unit ) add_ydb_test(NAME util-folder-iterator_ut @@ -37,6 +43,8 @@ add_ydb_test(NAME util-folder-iterator_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-folder-path_ut @@ -47,6 +55,8 @@ add_ydb_test(NAME util-folder-path_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-folder-pathsplit_ut @@ -57,4 +67,6 @@ add_ydb_test(NAME util-folder-pathsplit_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/util/folder/dirut_ut.cpp b/tests/unit/util/folder/dirut_ut.cpp similarity index 100% rename from tests/util/folder/dirut_ut.cpp rename to tests/unit/util/folder/dirut_ut.cpp diff --git a/tests/util/folder/filelist_ut.cpp b/tests/unit/util/folder/filelist_ut.cpp similarity index 100% rename from tests/util/folder/filelist_ut.cpp rename to tests/unit/util/folder/filelist_ut.cpp diff --git a/tests/util/folder/fts_ut.cpp b/tests/unit/util/folder/fts_ut.cpp similarity index 100% rename from tests/util/folder/fts_ut.cpp rename to tests/unit/util/folder/fts_ut.cpp diff --git a/tests/util/folder/iterator_ut.cpp b/tests/unit/util/folder/iterator_ut.cpp similarity index 100% rename from tests/util/folder/iterator_ut.cpp rename to tests/unit/util/folder/iterator_ut.cpp diff --git a/tests/util/folder/path_ut.cpp b/tests/unit/util/folder/path_ut.cpp similarity index 100% rename from tests/util/folder/path_ut.cpp rename to tests/unit/util/folder/path_ut.cpp diff --git a/tests/util/folder/pathsplit_ut.cpp b/tests/unit/util/folder/pathsplit_ut.cpp similarity index 98% rename from tests/util/folder/pathsplit_ut.cpp rename to tests/unit/util/folder/pathsplit_ut.cpp index 3a7767ab18c..72840dfacff 100644 --- a/tests/util/folder/pathsplit_ut.cpp +++ b/tests/unit/util/folder/pathsplit_ut.cpp @@ -20,7 +20,7 @@ #define PSUF(NAME) NAME #define PSUF_LOCAL(NAME) NAME##Local - #include + #include #undef PSUF #undef PSUF_LOCAL @@ -30,7 +30,7 @@ #undef _win_ #define REVERT_WIN #endif - #include + #include #ifdef REVERT_WIN #define _win_ #undef REVERT_WIN @@ -44,7 +44,7 @@ #define _win_ #define REVERT_WIN #endif - #include + #include #ifdef REVERT_WIN #undef _win_ #undef REVERT_WIN diff --git a/tests/util/network/CMakeLists.txt b/tests/unit/util/network/CMakeLists.txt similarity index 91% rename from tests/util/network/CMakeLists.txt rename to tests/unit/util/network/CMakeLists.txt index 8dd5dc6911d..9a04a114d89 100644 --- a/tests/util/network/CMakeLists.txt +++ b/tests/unit/util/network/CMakeLists.txt @@ -6,6 +6,8 @@ add_ydb_test(NAME util-network-iovec_ut LINK_LIBRARIES yutil cpp-testing-gtest_main + LABELS + unit ) add_ydb_test(NAME util-network-socket_ut @@ -16,6 +18,8 @@ add_ydb_test(NAME util-network-socket_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-network-address_ut @@ -26,6 +30,8 @@ add_ydb_test(NAME util-network-address_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-network-endpoint_ut @@ -36,6 +42,8 @@ add_ydb_test(NAME util-network-endpoint_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-network-ip_ut @@ -46,6 +54,8 @@ add_ydb_test(NAME util-network-ip_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-network-poller_ut @@ -56,6 +66,8 @@ add_ydb_test(NAME util-network-poller_ut LINK_LIBRARIES yutil cpp-testing-unittest_main + LABELS + unit ) add_ydb_test(NAME util-network-sock_ut @@ -67,4 +79,6 @@ add_ydb_test(NAME util-network-sock_ut yutil threading-future cpp-testing-unittest_main + LABELS + unit ) diff --git a/tests/util/network/address_ut.cpp b/tests/unit/util/network/address_ut.cpp similarity index 100% rename from tests/util/network/address_ut.cpp rename to tests/unit/util/network/address_ut.cpp diff --git a/tests/util/network/endpoint_ut.cpp b/tests/unit/util/network/endpoint_ut.cpp similarity index 100% rename from tests/util/network/endpoint_ut.cpp rename to tests/unit/util/network/endpoint_ut.cpp diff --git a/tests/util/network/iovec_ut.cpp b/tests/unit/util/network/iovec_ut.cpp similarity index 100% rename from tests/util/network/iovec_ut.cpp rename to tests/unit/util/network/iovec_ut.cpp diff --git a/tests/util/network/ip_ut.cpp b/tests/unit/util/network/ip_ut.cpp similarity index 100% rename from tests/util/network/ip_ut.cpp rename to tests/unit/util/network/ip_ut.cpp diff --git a/tests/util/network/poller_ut.cpp b/tests/unit/util/network/poller_ut.cpp similarity index 100% rename from tests/util/network/poller_ut.cpp rename to tests/unit/util/network/poller_ut.cpp diff --git a/tests/util/network/sock_ut.cpp b/tests/unit/util/network/sock_ut.cpp similarity index 100% rename from tests/util/network/sock_ut.cpp rename to tests/unit/util/network/sock_ut.cpp diff --git a/tests/util/network/socket_ut.cpp b/tests/unit/util/network/socket_ut.cpp similarity index 100% rename from tests/util/network/socket_ut.cpp rename to tests/unit/util/network/socket_ut.cpp