Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions ydb/core/tx/schemeshard/ut_helpers/ls_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace NLs {

using namespace NKikimr;

#define DESCRIBE_ASSERT_EQUAL(name, type, expression, description) \
#define DESCRIBE_ASSERT(op, name, type, expression, description) \
TCheckFunc name(type expected) { \
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) { \
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus()); \
Expand All @@ -22,13 +22,16 @@ using namespace NKikimr;
const auto& subdomain = pathDescr.GetDomainDescription(); \
const auto& value = expression; \
\
UNIT_ASSERT_EQUAL_C(value, expected, \
UNIT_ASSERT_##op(value, expected, \
description << " mismatch, subdomain with id " << subdomain.GetDomainKey().GetPathId() << \
" has value " << value << \
" but expected " << expected); \
}; \
}

#define DESCRIBE_ASSERT_EQUAL(name, type, expression, description) DESCRIBE_ASSERT(EQUAL_C, name, type, expression, description)
#define DESCRIBE_ASSERT_GE(name, type, expression, description) DESCRIBE_ASSERT(GE_C, name, type, expression, description)


void NotInSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT(record.HasPathDescription());
Expand Down Expand Up @@ -671,6 +674,7 @@ TCheckFunc PQPartitionsInsideDomain(ui64 count) {

DESCRIBE_ASSERT_EQUAL(TopicReservedStorage, ui64, subdomain.GetDiskSpaceUsage().GetTopics().GetReserveSize(), "Topic ReserveSize")
DESCRIBE_ASSERT_EQUAL(TopicAccountSize, ui64, subdomain.GetDiskSpaceUsage().GetTopics().GetAccountSize(), "Topic AccountSize")
DESCRIBE_ASSERT_GE(TopicAccountSizeGE, ui64, subdomain.GetDiskSpaceUsage().GetTopics().GetAccountSize(), "Topic AccountSize")
DESCRIBE_ASSERT_EQUAL(TopicUsedReserveSize, ui64, subdomain.GetDiskSpaceUsage().GetTopics().GetUsedReserveSize(), "Topic UsedReserveSize")

TCheckFunc PathsInsideDomainOneOf(TSet<ui64> variants) {
Expand Down Expand Up @@ -1185,6 +1189,8 @@ TCheckFunc ServerlessComputeResourcesMode(NKikimrSubDomains::EServerlessComputeR
}

#undef DESCRIBE_ASSERT_EQUAL
#undef DESCRIBE_ASSERT_GE
#undef DESCRIBE_ASSERT

} // NLs
} // NSchemeShardUT_Private
1 change: 1 addition & 0 deletions ydb/core/tx/schemeshard/ut_helpers/ls_checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace NLs {
TCheckFunc PQPartitionsInsideDomain(ui64 count);
TCheckFunc TopicReservedStorage(ui64 expected);
TCheckFunc TopicAccountSize(ui64 expected);
TCheckFunc TopicAccountSizeGE(ui64 expected);
TCheckFunc TopicUsedReserveSize(ui64 expected);
TCheckFunc PathsInsideDomainOneOf(TSet<ui64> variants);
TCheckFunc ShardsInsideDomain(ui64 count);
Expand Down
4 changes: 2 additions & 2 deletions ydb/core/tx/schemeshard/ut_stats/ut_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ Y_UNIT_TEST_SUITE(TSchemeshardStatsBatchingTest) {
const auto Assert = [&] (ui64 expectedAccountSize, ui64 expectedUsedReserveSize) {
TestDescribeResult(DescribePath(runtime,topicPath),
{NLs::Finished,
NLs::TopicAccountSize(expectedAccountSize),
NLs::TopicAccountSizeGE(expectedAccountSize),
NLs::TopicUsedReserveSize(expectedUsedReserveSize)});
};

Expand Down Expand Up @@ -550,7 +550,7 @@ Y_UNIT_TEST_SUITE(TSchemeshardStatsBatchingTest) {
const auto AssertTopicSize = [&] (ui64 expectedAccountSize, ui64 expectedUsedReserveSize) {
TestDescribeResult(DescribePath(runtime, "/MyRoot/Topic1"),
{NLs::Finished,
NLs::TopicAccountSize(expectedAccountSize),
NLs::TopicAccountSizeGE(expectedAccountSize),
NLs::TopicUsedReserveSize(expectedUsedReserveSize)});
};

Expand Down