Skip to content

Commit

Permalink
Moved commit "The DescripeTopic call with the IncludeStats flag freez…
Browse files Browse the repository at this point in the history
…es" from ydb repo
  • Loading branch information
Alek5andr-Kotov authored and Gazizonoki committed Sep 18, 2024
1 parent 7568c86 commit a889e72
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/client/topic/ut/topic_to_table_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class TFixture : public NUnitTest::TBaseFixture {
size_t partitionCount = 1,
std::optional<size_t> maxPartitionCount = std::nullopt);

void DescribeTopic(const TString& path);

void WriteToTopicWithInvalidTxId(bool invalidTxId);

TTopicWriteSessionPtr CreateTopicWriteSession(const TString& topicPath,
Expand Down Expand Up @@ -328,6 +330,11 @@ void TFixture::CreateTopic(const TString& path,
Setup->CreateTopic(path, consumer, partitionCount, maxPartitionCount);
}

void TFixture::DescribeTopic(const TString& path)
{
Setup->DescribeTopic(path);
}

const TDriver& TFixture::GetDriver() const
{
return *Driver;
Expand Down Expand Up @@ -1122,6 +1129,8 @@ Y_UNIT_TEST_F(WriteToTopic_Demo_6, TFixture)
UNIT_ASSERT_VALUES_EQUAL(messages[0], "message #1");
UNIT_ASSERT_VALUES_EQUAL(messages[1], "message #2");
}

DescribeTopic("topic_A");
}

Y_UNIT_TEST_F(WriteToTopic_Demo_7, TFixture)
Expand Down
12 changes: 12 additions & 0 deletions src/client/topic/ut/ut_utils/topic_sdk_test_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ void TTopicSdkTestSetup::CreateTopic(const TString& path, const TString& consume
Server.WaitInit(path);
}

void TTopicSdkTestSetup::DescribeTopic(const TString& path)
{
TTopicClient client(MakeDriver());

TDescribeTopicSettings settings;
settings.IncludeStats(true);
settings.IncludeLocation(true);

auto status = client.DescribeTopic(path, settings).GetValueSync();
UNIT_ASSERT(status.IsSuccess());
}

TString TTopicSdkTestSetup::GetEndpoint() const {
return "localhost:" + ToString(Server.GrpcPort);
}
Expand Down
2 changes: 2 additions & 0 deletions src/client/topic/ut/ut_utils/topic_sdk_test_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class TTopicSdkTestSetup {
void CreateTopicWithAutoscale(const TString& path = TString{TEST_TOPIC}, const TString& consumer = TEST_CONSUMER, size_t partitionCount = 1,
size_t maxPartitionCount = 100);

void DescribeTopic(const TString& path = TEST_TOPIC);

TString GetEndpoint() const;
TString GetTopicPath(const TString& name = TString{TEST_TOPIC}) const;
TString GetTopicParent() const;
Expand Down

0 comments on commit a889e72

Please sign in to comment.