diff options
author | Tony-Romanov <150126326+Tony-Romanov@users.noreply.github.com> | 2024-10-28 19:20:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-28 19:20:45 +0100 |
commit | 1a50a11c4ce1401c4603238e26f43e1fed69a917 (patch) | |
tree | 3d3b2d627413f0133a796dea91898e73d8c7e3d9 | |
parent | 634dc2025c2a7bbb0093b1a63dd2e64f969a497f (diff) | |
download | ydb-1a50a11c4ce1401c4603238e26f43e1fed69a917.tar.gz |
Add simple UT for storage load test actor. (#10894)
-rw-r--r-- | ydb/core/load_test/ut/group_test_ut.cpp | 69 | ||||
-rw-r--r-- | ydb/core/load_test/ut/ya.make | 17 | ||||
-rw-r--r-- | ydb/core/load_test/ya.make | 1 |
3 files changed, 87 insertions, 0 deletions
diff --git a/ydb/core/load_test/ut/group_test_ut.cpp b/ydb/core/load_test/ut/group_test_ut.cpp new file mode 100644 index 0000000000..6590bc8713 --- /dev/null +++ b/ydb/core/load_test/ut/group_test_ut.cpp @@ -0,0 +1,69 @@ +#include <ydb/core/blobstorage/ut_blobstorage/lib/env.h> +#include <ydb/core/load_test/service_actor.h> + +#include <library/cpp/protobuf/util/pb_io.h> + +namespace { + +struct TTetsEnv { + TTetsEnv() + : Env({ + .NodeCount = 8, + .VDiskReplPausedAtStart = false, + .Erasure = TBlobStorageGroupType::Erasure4Plus2Block, + }) + , Counters(new ::NMonitoring::TDynamicCounters()) + { + Env.CreateBoxAndPool(1, 1); + Env.Sim(TDuration::Minutes(1)); + + auto groups = Env.GetGroups(); + UNIT_ASSERT_VALUES_EQUAL(groups.size(), 1); + GroupInfo = Env.GetGroupInfo(groups.front()); + + VDiskActorId = GroupInfo->GetActorId(0); + + Env.Runtime->SetLogPriority(NKikimrServices::BS_LOAD_TEST, NLog::PRI_DEBUG); + } + + TString RunSingleLoadTest(const TString& command) { + const auto sender = Env.Runtime->AllocateEdgeActor(VDiskActorId.NodeId(), __FILE__, __LINE__); + auto stream = TStringInput(command); + + const ui64 tag = 42ULL; + GroupWriteActorId = Env.Runtime->Register(CreateWriterLoadTest(ParseFromTextFormat<NKikimr::TEvLoadTestRequest::TStorageLoad>(stream), sender, Counters, tag), sender, 0, std::nullopt, VDiskActorId.NodeId()); + + const auto res = Env.WaitForEdgeActorEvent<TEvLoad::TEvLoadTestFinished>(sender, true); + UNIT_ASSERT_VALUES_EQUAL(res->Get()->Tag, tag); + return res->Get()->LastHtmlPage; + } + + TEnvironmentSetup Env; + TIntrusivePtr<TBlobStorageGroupInfo> GroupInfo; + TActorId VDiskActorId; + TActorId GroupWriteActorId; + TIntrusivePtr<::NMonitoring::TDynamicCounters> Counters; +}; + +} + +Y_UNIT_TEST_SUITE(GroupWriteTest) { + + Y_UNIT_TEST(Simple) { + TTetsEnv env; + + const TString conf(R"(DurationSeconds: 3 + Tablets: { + Tablets: { TabletId: 1 Channel: 0 GroupId: )" + ToString(env.GroupInfo->GroupID) + R"( Generation: 1 } + WriteSizes: { Weight: 1.0 Min: 1000000 Max: 4000000 } + WriteIntervals: { Weight: 1.0 Uniform: { MinUs: 100000 MaxUs: 100000 } } + MaxInFlightWriteRequests: 10 + FlushIntervals: { Weight: 1.0 Uniform: { MinUs: 1000000 MaxUs: 1000000 } } + PutHandleClass: TabletLog + })" + ); + + const auto html = env.RunSingleLoadTest(conf); + UNIT_ASSERT(html.Contains("<tr><td>BadPutResults</td><td>0</td></tr>")); + } +} diff --git a/ydb/core/load_test/ut/ya.make b/ydb/core/load_test/ut/ya.make new file mode 100644 index 0000000000..42af1baeda --- /dev/null +++ b/ydb/core/load_test/ut/ya.make @@ -0,0 +1,17 @@ +UNITTEST_FOR(ydb/core/load_test) + +FORK_SUBTESTS(MODULO) + +TIMEOUT(600) +SIZE(MEDIUM) + +PEERDIR( + ydb/core/blobstorage/ut_blobstorage/lib + ydb/core/testlib/default +) + +YQL_LAST_ABI_VERSION() + +SRCS(group_test_ut.cpp) + +END() diff --git a/ydb/core/load_test/ya.make b/ydb/core/load_test/ya.make index 77af9bfcfd..354d1b11a8 100644 --- a/ydb/core/load_test/ya.make +++ b/ydb/core/load_test/ya.make @@ -62,5 +62,6 @@ GENERATE_ENUM_SERIALIZATION(percentile.h) END() RECURSE_FOR_TESTS( + ut ut_ycsb ) |