diff options
author | serg-belyakov <serg-belyakov@yandex-team.com> | 2023-05-17 16:21:09 +0300 |
---|---|---|
committer | serg-belyakov <serg-belyakov@yandex-team.com> | 2023-05-17 16:21:09 +0300 |
commit | 76d2abf021112a0d483ea77ea01c2c85daac21be (patch) | |
tree | ae66f620ab454bdcbaee26f165ec90764377e1ab | |
parent | 2c846092d67299183480076899a56ee76e9c8515 (diff) | |
download | ydb-76d2abf021112a0d483ea77ea01c2c85daac21be.tar.gz |
Improve UT, assure that group layout sanitizer doesn't send requests to valid groups,
Assure that group layout sanitizer doesn't send requests to valid groups
-rw-r--r-- | ydb/core/blobstorage/ut_blobstorage/sanitize_groups.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ydb/core/blobstorage/ut_blobstorage/sanitize_groups.cpp b/ydb/core/blobstorage/ut_blobstorage/sanitize_groups.cpp index f942746626c..5d4986d228c 100644 --- a/ydb/core/blobstorage/ut_blobstorage/sanitize_groups.cpp +++ b/ydb/core/blobstorage/ut_blobstorage/sanitize_groups.cpp @@ -35,6 +35,20 @@ Y_UNIT_TEST_SUITE(GroupLayoutSanitizer) { .LocationGenerator = [&](ui32 nodeId) { return locations[nodeId - 1]; }, }}; + + auto catchSanitizeRequests = [](ui32 /*nodeId*/, std::unique_ptr<IEventHandle>& ev) { + if (ev->GetTypeRewrite() == TEvBlobStorage::TEvControllerConfigRequest::EventType) { + const auto& request = ev->Get<TEvBlobStorage::TEvControllerConfigRequest>()->Record.GetRequest(); + for (const auto& command : request.GetCommand()) { + UNIT_ASSERT(command.GetCommandCase() != NKikimrBlobStorage::TConfigRequest::TCommand::kSanitizeGroup); + } + } + return true; + }; + + env.Runtime->FilterFunction = catchSanitizeRequests; + + // Initialize runtime TGroupGeometryInfo geom = CreateGroupGeometry(groupType); const ui32 disksPerNode = 1; @@ -47,6 +61,7 @@ Y_UNIT_TEST_SUITE(GroupLayoutSanitizer) { UNIT_ASSERT_C(CheckBaseConfigLayout(geom, cfg, error), error); env.Cleanup(); + // Shuffle node locayion, assure that layout error occured std::random_shuffle(locations.begin(), locations.end()); env.Initialize(); env.Sim(TDuration::Seconds(100)); @@ -54,9 +69,17 @@ Y_UNIT_TEST_SUITE(GroupLayoutSanitizer) { CheckBaseConfigLayout(geom, cfg, error); Cerr << error << Endl; + // Sanitize groups + env.Runtime->FilterFunction = {}; env.UpdateSettings(true, false, true); env.Sim(TDuration::Minutes(15)); cfg = env.FetchBaseConfig(); UNIT_ASSERT_C(CheckBaseConfigLayout(geom, cfg, error), error); + + // Assure that sanitizer doesn't send request to fully sane groups + env.Runtime->FilterFunction = catchSanitizeRequests; + env.Sim(TDuration::Minutes(3)); + cfg = env.FetchBaseConfig(); + UNIT_ASSERT_C(CheckBaseConfigLayout(geom, cfg, error), error); } } |