|
| 1 | +#include <ydb/core/blobstorage/ut_blobstorage/lib/env.h> |
| 2 | +#include <ydb/core/load_test/service_actor.h> |
| 3 | + |
| 4 | +#include <library/cpp/protobuf/util/pb_io.h> |
| 5 | + |
| 6 | +namespace { |
| 7 | + |
| 8 | +struct TTetsEnv { |
| 9 | + TTetsEnv() |
| 10 | + : Env({ |
| 11 | + .NodeCount = 8, |
| 12 | + .VDiskReplPausedAtStart = false, |
| 13 | + .Erasure = TBlobStorageGroupType::Erasure4Plus2Block, |
| 14 | + }) |
| 15 | + , Counters(new ::NMonitoring::TDynamicCounters()) |
| 16 | + { |
| 17 | + Env.CreateBoxAndPool(1, 1); |
| 18 | + Env.Sim(TDuration::Minutes(1)); |
| 19 | + |
| 20 | + auto groups = Env.GetGroups(); |
| 21 | + UNIT_ASSERT_VALUES_EQUAL(groups.size(), 1); |
| 22 | + GroupInfo = Env.GetGroupInfo(groups.front()); |
| 23 | + |
| 24 | + VDiskActorId = GroupInfo->GetActorId(0); |
| 25 | + |
| 26 | + Env.Runtime->SetLogPriority(NKikimrServices::BS_LOAD_TEST, NLog::PRI_DEBUG); |
| 27 | + } |
| 28 | + |
| 29 | + TString RunSingleLoadTest(const TString& command) { |
| 30 | + const auto sender = Env.Runtime->AllocateEdgeActor(VDiskActorId.NodeId(), __FILE__, __LINE__); |
| 31 | + auto stream = TStringInput(command); |
| 32 | + |
| 33 | + const ui64 tag = 42ULL; |
| 34 | + GroupWriteActorId = Env.Runtime->Register(CreateWriterLoadTest(ParseFromTextFormat<NKikimr::TEvLoadTestRequest::TStorageLoad>(stream), sender, Counters, tag), sender, 0, std::nullopt, VDiskActorId.NodeId()); |
| 35 | + |
| 36 | + const auto res = Env.WaitForEdgeActorEvent<TEvLoad::TEvLoadTestFinished>(sender, true); |
| 37 | + UNIT_ASSERT_VALUES_EQUAL(res->Get()->Tag, tag); |
| 38 | + return res->Get()->LastHtmlPage; |
| 39 | + } |
| 40 | + |
| 41 | + TEnvironmentSetup Env; |
| 42 | + TIntrusivePtr<TBlobStorageGroupInfo> GroupInfo; |
| 43 | + TActorId VDiskActorId; |
| 44 | + TActorId GroupWriteActorId; |
| 45 | + TIntrusivePtr<::NMonitoring::TDynamicCounters> Counters; |
| 46 | +}; |
| 47 | + |
| 48 | +} |
| 49 | + |
| 50 | +Y_UNIT_TEST_SUITE(GroupWriteTest) { |
| 51 | + |
| 52 | + Y_UNIT_TEST(Simple) { |
| 53 | + TTetsEnv env; |
| 54 | + |
| 55 | + const TString conf(R"(DurationSeconds: 3 |
| 56 | + Tablets: { |
| 57 | + Tablets: { TabletId: 1 Channel: 0 GroupId: )" + ToString(env.GroupInfo->GroupID) + R"( Generation: 1 } |
| 58 | + WriteSizes: { Weight: 1.0 Min: 1000000 Max: 4000000 } |
| 59 | + WriteIntervals: { Weight: 1.0 Uniform: { MinUs: 100000 MaxUs: 100000 } } |
| 60 | + MaxInFlightWriteRequests: 10 |
| 61 | + FlushIntervals: { Weight: 1.0 Uniform: { MinUs: 1000000 MaxUs: 1000000 } } |
| 62 | + PutHandleClass: TabletLog |
| 63 | + })" |
| 64 | + ); |
| 65 | + |
| 66 | + const auto html = env.RunSingleLoadTest(conf); |
| 67 | + UNIT_ASSERT(html.Contains("<tr><td>BadPutResults</td><td>0</td></tr>")); |
| 68 | + } |
| 69 | +} |
0 commit comments