Skip to content

Commit 7727fa8

Browse files
authored
fix incorrect group ids in test (#14775)
1 parent 02fadfa commit 7727fa8

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

ydb/core/mind/hive/hive_ut.cpp

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3000,14 +3000,6 @@ Y_UNIT_TEST_SUITE(THiveTest) {
30003000

30013001
// Incorrect test, muted
30023002
Y_UNIT_TEST(TestReassignUseRelativeSpace) {
3003-
// TODO: Remove this code after issue https://github.com/ydb-platform/ydb/issues/12255 will be resolved
3004-
ui64 prevSeed = NActors::DefaultRandomSeed;
3005-
NActors::DefaultRandomSeed = 42;
3006-
Y_SCOPE_EXIT(prevSeed) {
3007-
NActors::DefaultRandomSeed = prevSeed;
3008-
};
3009-
// TODO: Remove this code after issue https://github.com/ydb-platform/ydb/issues/12255 will be resolved
3010-
30113003
TTestBasicRuntime runtime(1, false);
30123004
Setup(runtime, true, 5);
30133005
const ui64 hiveTablet = MakeDefaultHiveID();
@@ -3020,7 +3012,7 @@ Y_UNIT_TEST_SUITE(THiveTest) {
30203012
MakeSureTabletIsUp(runtime, tabletId, 0);
30213013

30223014
TActorId sender = runtime.AllocateEdgeActor();
3023-
std::unordered_set<ui32> otherPoolGroops;
3015+
std::unordered_set<ui32> unusedGroups;
30243016
auto getGroup = [&runtime, sender, hiveTablet](ui64 tabletId) {
30253017
runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo({
30263018
.TabletId = tabletId,
@@ -3039,31 +3031,28 @@ Y_UNIT_TEST_SUITE(THiveTest) {
30393031
THolder<TEvBlobStorage::TEvControllerSelectGroups> selectGroups = MakeHolder<TEvBlobStorage::TEvControllerSelectGroups>();
30403032
NKikimrBlobStorage::TEvControllerSelectGroups& record = selectGroups->Record;
30413033
record.SetReturnAllMatchingGroups(true);
3042-
std::vector<TString> storagePools = {"def2", "def3"}; // we will work with pool def1, so we want to avoid messing with other pools
3043-
for (const auto& pool : storagePools) {
3044-
record.AddGroupParameters()->MutableStoragePoolSpecifier()->SetName(pool);
3045-
}
3034+
record.AddGroupParameters()->MutableStoragePoolSpecifier()->SetName("def1");
30463035
runtime.SendToPipe(MakeBSControllerID(), sender, selectGroups.Release());
30473036
TAutoPtr<IEventHandle> handle;
30483037
TEvBlobStorage::TEvControllerSelectGroupsResult* response = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerSelectGroupsResult>(handle);
30493038
for (const auto& matchingGroups : response->Record.GetMatchingGroups()) {
30503039
for (const auto& group : matchingGroups.GetGroups()) {
3051-
otherPoolGroops.insert(group.GetGroupID());
3040+
unusedGroups.insert(group.GetGroupID());
30523041
}
30533042
}
30543043
}
30553044

3056-
auto getFreshGroup = [&otherPoolGroops](ui32 start) {
3057-
for (ui32 groupId = start + 1;; ++groupId) {
3058-
if (!otherPoolGroops.contains(groupId)) {
3059-
return groupId;
3060-
}
3061-
}
3045+
auto getFreshGroup = [&unusedGroups]() {
3046+
UNIT_ASSERT(!unusedGroups.empty());
3047+
ui32 group = *unusedGroups.begin();
3048+
unusedGroups.erase(unusedGroups.begin());
3049+
return group;
30623050
};
30633051

30643052
ui32 initialGroup = getGroup(tabletId);
3065-
ui32 badGroup = getFreshGroup(initialGroup);
3066-
ui32 goodGroup = getFreshGroup(badGroup);
3053+
unusedGroups.erase(initialGroup);
3054+
ui32 badGroup = getFreshGroup();
3055+
ui32 goodGroup = getFreshGroup();
30673056
Ctest << "Tablet is now in group " << initialGroup << ", should later move to " << goodGroup << Endl;
30683057

30693058
struct TTestGroupInfo {

0 commit comments

Comments
 (0)