aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabcdef <akotov@ydb.tech>2023-06-30 11:22:40 +0300
committerabcdef <akotov@ydb.tech>2023-06-30 11:22:40 +0300
commit5c695412dab36725221e24bb4c5031789623bc70 (patch)
treee6bfbe76168acf1bed59bb0f1f38092927468824
parent54947f36c3e859b9de760b04ca870e347433683b (diff)
downloadydb-5c695412dab36725221e24bb4c5031789623bc70.tar.gz
simple test for 'ydb workload topic run full`
простой тест с рецептом
-rw-r--r--ydb/apps/ydb/CMakeLists.linux-aarch64.txt1
-rw-r--r--ydb/apps/ydb/CMakeLists.linux-x86_64.txt1
-rw-r--r--ydb/apps/ydb/ut/CMakeLists.linux-aarch64.txt66
-rw-r--r--ydb/apps/ydb/ut/CMakeLists.linux-x86_64.txt68
-rw-r--r--ydb/apps/ydb/ut/CMakeLists.txt13
-rw-r--r--ydb/apps/ydb/ut/main.cpp48
-rw-r--r--ydb/apps/ydb/ut/ya.make13
-rw-r--r--ydb/apps/ydb/ya.make6
8 files changed, 216 insertions, 0 deletions
diff --git a/ydb/apps/ydb/CMakeLists.linux-aarch64.txt b/ydb/apps/ydb/CMakeLists.linux-aarch64.txt
index c3c69ca9756..b4b252b29b5 100644
--- a/ydb/apps/ydb/CMakeLists.linux-aarch64.txt
+++ b/ydb/apps/ydb/CMakeLists.linux-aarch64.txt
@@ -7,6 +7,7 @@
add_subdirectory(commands)
+add_subdirectory(ut)
get_built_tool_path(
TOOL_rescompiler_bin
TOOL_rescompiler_dependency
diff --git a/ydb/apps/ydb/CMakeLists.linux-x86_64.txt b/ydb/apps/ydb/CMakeLists.linux-x86_64.txt
index 86e78d9ecb5..c6722e7f54b 100644
--- a/ydb/apps/ydb/CMakeLists.linux-x86_64.txt
+++ b/ydb/apps/ydb/CMakeLists.linux-x86_64.txt
@@ -7,6 +7,7 @@
add_subdirectory(commands)
+add_subdirectory(ut)
get_built_tool_path(
TOOL_rescompiler_bin
TOOL_rescompiler_dependency
diff --git a/ydb/apps/ydb/ut/CMakeLists.linux-aarch64.txt b/ydb/apps/ydb/ut/CMakeLists.linux-aarch64.txt
new file mode 100644
index 00000000000..30da5d464da
--- /dev/null
+++ b/ydb/apps/ydb/ut/CMakeLists.linux-aarch64.txt
@@ -0,0 +1,66 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_executable(ydb-apps-ydb-ut)
+target_link_libraries(ydb-apps-ydb-ut PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ cpp-testing-unittest_main
+)
+target_link_options(ydb-apps-ydb-ut PRIVATE
+ -ldl
+ -lrt
+ -Wl,--no-as-needed
+ -fPIC
+ -fPIC
+ -lpthread
+ -lrt
+ -ldl
+)
+target_sources(ydb-apps-ydb-ut PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/apps/ydb/ut/main.cpp
+)
+set_property(
+ TARGET
+ ydb-apps-ydb-ut
+ PROPERTY
+ SPLIT_FACTOR
+ 1
+)
+add_yunittest(
+ NAME
+ ydb-apps-ydb-ut
+ TEST_TARGET
+ ydb-apps-ydb-ut
+ TEST_ARG
+ --print-before-suite
+ --print-before-test
+ --fork-tests
+ --print-times
+ --show-fails
+)
+set_yunittest_property(
+ TEST
+ ydb-apps-ydb-ut
+ PROPERTY
+ LABELS
+ SMALL
+)
+set_yunittest_property(
+ TEST
+ ydb-apps-ydb-ut
+ PROPERTY
+ PROCESSORS
+ 1
+)
+target_allocator(ydb-apps-ydb-ut
+ cpp-malloc-jemalloc
+)
+vcs_info(ydb-apps-ydb-ut)
diff --git a/ydb/apps/ydb/ut/CMakeLists.linux-x86_64.txt b/ydb/apps/ydb/ut/CMakeLists.linux-x86_64.txt
new file mode 100644
index 00000000000..9792960b278
--- /dev/null
+++ b/ydb/apps/ydb/ut/CMakeLists.linux-x86_64.txt
@@ -0,0 +1,68 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_executable(ydb-apps-ydb-ut)
+target_link_libraries(ydb-apps-ydb-ut PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ library-cpp-cpuid_check
+ cpp-testing-unittest_main
+)
+target_link_options(ydb-apps-ydb-ut PRIVATE
+ -ldl
+ -lrt
+ -Wl,--no-as-needed
+ -fPIC
+ -fPIC
+ -lpthread
+ -lrt
+ -ldl
+)
+target_sources(ydb-apps-ydb-ut PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/apps/ydb/ut/main.cpp
+)
+set_property(
+ TARGET
+ ydb-apps-ydb-ut
+ PROPERTY
+ SPLIT_FACTOR
+ 1
+)
+add_yunittest(
+ NAME
+ ydb-apps-ydb-ut
+ TEST_TARGET
+ ydb-apps-ydb-ut
+ TEST_ARG
+ --print-before-suite
+ --print-before-test
+ --fork-tests
+ --print-times
+ --show-fails
+)
+set_yunittest_property(
+ TEST
+ ydb-apps-ydb-ut
+ PROPERTY
+ LABELS
+ SMALL
+)
+set_yunittest_property(
+ TEST
+ ydb-apps-ydb-ut
+ PROPERTY
+ PROCESSORS
+ 1
+)
+target_allocator(ydb-apps-ydb-ut
+ cpp-malloc-tcmalloc
+ libs-tcmalloc-no_percpu_cache
+)
+vcs_info(ydb-apps-ydb-ut)
diff --git a/ydb/apps/ydb/ut/CMakeLists.txt b/ydb/apps/ydb/ut/CMakeLists.txt
new file mode 100644
index 00000000000..4d48dcdee65
--- /dev/null
+++ b/ydb/apps/ydb/ut/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-aarch64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-x86_64.txt)
+endif()
diff --git a/ydb/apps/ydb/ut/main.cpp b/ydb/apps/ydb/ut/main.cpp
new file mode 100644
index 00000000000..0bd3be64cbb
--- /dev/null
+++ b/ydb/apps/ydb/ut/main.cpp
@@ -0,0 +1,48 @@
+#include <library/cpp/testing/common/env.h>
+#include <library/cpp/testing/unittest/registar.h>
+
+#include <util/string/cast.h>
+#include <util/string/split.h>
+#include <util/system/env.h>
+#include <util/system/shellcommand.h>
+
+TString ExecYdbWorkloadTopic(TList<TString> args)
+{
+ //
+ // ydb -e grpc://${YDB_ENDPOINT} -d /${YDB_DATABASE} workload topic ${args}
+ //
+
+ args.push_front("topic");
+ args.push_front("workload");
+
+ args.push_front("/" + GetEnv("YDB_DATABASE"));
+ args.push_front("-d");
+
+ args.push_front("grpc://" + GetEnv("YDB_ENDPOINT"));
+ args.push_front("-e");
+
+ TShellCommand command(BinaryPath("ydb/apps/ydb/ydb"), args);
+ command.Run().Wait();
+
+ UNIT_ASSERT_VALUES_EQUAL(command.GetExitCode(), 0);
+
+ return command.GetOutput();
+}
+
+Y_UNIT_TEST_SUITE(YdbWorkloadTopic) {
+Y_UNIT_TEST(RunFull) {
+ ExecYdbWorkloadTopic({"init"});
+ auto output = ExecYdbWorkloadTopic({"run", "full", "-s", "10"});
+ ExecYdbWorkloadTopic({"clean"});
+
+ TVector<TString> lines, columns;
+
+ Split(output, "\n", lines);
+ Split(lines.back(), "\t", columns);
+
+ auto fullTime = FromString<ui64>(columns.back());
+
+ UNIT_ASSERT_GE(fullTime, 0);
+ UNIT_ASSERT_LT(fullTime, 10'000);
+}
+}
diff --git a/ydb/apps/ydb/ut/ya.make b/ydb/apps/ydb/ut/ya.make
new file mode 100644
index 00000000000..c9ee286ae37
--- /dev/null
+++ b/ydb/apps/ydb/ut/ya.make
@@ -0,0 +1,13 @@
+UNITTEST()
+
+DEPENDS(
+ ydb/apps/ydb
+)
+
+SRCS(
+ main.cpp
+)
+
+INCLUDE(${ARCADIA_ROOT}/ydb/public/tools/ydb_recipe/recipe.inc)
+
+END()
diff --git a/ydb/apps/ydb/ya.make b/ydb/apps/ydb/ya.make
index 152d9446af1..b971d714c31 100644
--- a/ydb/apps/ydb/ya.make
+++ b/ydb/apps/ydb/ya.make
@@ -43,3 +43,9 @@ CHECK_DEPENDENT_DIRS(
)
END()
+
+IF (OS_LINUX)
+ RECURSE_FOR_TESTS(
+ ut
+ )
+ENDIF()