Skip to content

Commit

Permalink
[Blockstore] fix ShouldHandleDescribeBlocksRequestForMultipartitionVo…
Browse files Browse the repository at this point in the history
…lume test (#893)
  • Loading branch information
BarkovBG authored Apr 3, 2024
1 parent b36e985 commit 1160233
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions cloud/blockstore/libs/storage/volume/volume_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3671,12 +3671,20 @@ Y_UNIT_TEST_SUITE(TVolumeTest)

volume.SendToPipe(std::move(request));
const auto response1 = volume.RecvResponse<TEvVolume::TEvDescribeBlocksResponse>();
const auto& message1 = response1->Record;
auto& message1 = response1->Record;

UNIT_ASSERT(SUCCEEDED(response1->GetStatus()));
UNIT_ASSERT_VALUES_EQUAL(0, message1.FreshBlockRangesSize());
UNIT_ASSERT_VALUES_EQUAL(8, message1.BlobPiecesSize());

// Sort blob pieces because partitions may answer in any order.
SortBy(
*message1.MutableBlobPieces(),
[](const auto& blobPiece) {
return blobPiece.GetRanges(0).GetBlockIndex();
}
);

const auto& blobPiece1 = message1.GetBlobPieces(0);
UNIT_ASSERT_VALUES_EQUAL(513, blobPiece1.RangesSize());
const auto& range1 = blobPiece1.GetRanges(0);
Expand All @@ -3699,12 +3707,20 @@ Y_UNIT_TEST_SUITE(TVolumeTest)

volume.SendToPipe(std::move(request));
const auto response2 = volume.RecvResponse<TEvVolume::TEvDescribeBlocksResponse>();
const auto& message2 = response2->Record;
auto& message2 = response2->Record;

UNIT_ASSERT(SUCCEEDED(response2->GetStatus()));
UNIT_ASSERT_VALUES_EQUAL(256, message2.FreshBlockRangesSize());
UNIT_ASSERT_VALUES_EQUAL(0, message2.BlobPiecesSize());

// Sort fresh block ranges because partitions may answer in any order.
SortBy(
*message2.MutableFreshBlockRanges(),
[](const auto& freshBlockRange) {
return freshBlockRange.GetStartIndex();
}
);

const auto& freshBlockRange1 = message2.GetFreshBlockRanges(0);
UNIT_ASSERT_VALUES_EQUAL(9000, freshBlockRange1.GetStartIndex());
UNIT_ASSERT_VALUES_EQUAL(1, freshBlockRange1.GetBlocksCount());
Expand Down

0 comments on commit 1160233

Please sign in to comment.