Skip to content

Commit c768fe8

Browse files
committed
Fixed CMakeLists for import 14
1 parent e546592 commit c768fe8

File tree

7 files changed

+129
-88
lines changed

7 files changed

+129
-88
lines changed

include/ydb-cpp-sdk/client/query/client.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ struct TClientSettings : public TCommonClientSettingsBase<TClientSettings> {
5353
FLUENT_SETTING(TSessionPoolSettings, SessionPoolSettings);
5454
};
5555

56-
// ! WARNING: Experimental API
57-
// ! This API is currently in experimental state and is a subject for changes.
58-
// ! No backward and/or forward compatibility guarantees are provided.
59-
// ! DO NOT USE for production workloads.
6056
class TQueryClient {
6157
friend class TSession;
6258
friend class NRetry::Async::TRetryContext<TQueryClient, TAsyncExecuteQueryResult>;

tests/integration/topic/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ add_ydb_test(NAME topic_it GTEST
66
basic_usage.cpp
77
describe_topic.cpp
88
local_partition.cpp
9+
topic_to_table.cpp
910
trace.cpp
1011
LINK_LIBRARIES
1112
topic_it_utils
@@ -24,6 +25,7 @@ add_ydb_test(NAME topic_direct_read_it GTEST
2425
describe_topic.cpp
2526
local_partition.cpp
2627
direct_read.cpp
28+
topic_to_table.cpp
2729
LINK_LIBRARIES
2830
topic_it_utils
2931
topic_it_setup

tests/integration/topic/setup/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ target_sources(topic_it_setup
77

88
target_link_libraries(topic_it_setup
99
PUBLIC
10+
topic_it_utils
1011
YDB-CPP-SDK::Discovery
12+
YDB-CPP-SDK::Scheme
13+
YDB-CPP-SDK::Table
1114
YDB-CPP-SDK::Topic
1215
GTest::gtest
1316
)

tests/integration/topic/setup/fixture.cpp

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#include "fixture.h"
22

33
#include <ydb-cpp-sdk/client/discovery/discovery.h>
4+
#include <ydb-cpp-sdk/client/scheme/scheme.h>
5+
#include <ydb-cpp-sdk/client/table/table.h>
46

5-
#include <util/system/execpath.h>
7+
8+
using namespace NYdb::NScheme;
9+
using namespace NYdb::NTable;
610

711
namespace NYdb::inline V3::NTopic::NTests {
812

@@ -18,12 +22,11 @@ void TTopicTestFixture::SetUp() {
1822
TTopicClient client(MakeDriver());
1923

2024
const testing::TestInfo* const testInfo = testing::UnitTest::GetInstance()->current_test_info();
21-
std::filesystem::path execPath(std::string{GetExecPath()});
2225

2326
std::stringstream topicBuilder;
2427
topicBuilder << std::getenv("YDB_TEST_ROOT") << "/" << testInfo->test_suite_name() << "-" << testInfo->name() << "/";
2528
TopicPrefix_ = topicBuilder.str();
26-
29+
2730
std::stringstream consumerBuilder;
2831
consumerBuilder << testInfo->test_suite_name() << "-" << testInfo->name() << "-";
2932
ConsumerPrefix_ = consumerBuilder.str();
@@ -32,6 +35,36 @@ void TTopicTestFixture::SetUp() {
3235
CreateTopic();
3336
}
3437

38+
void TTopicTestFixture::RemoveDirectoryRecurive(const std::string& path) const {
39+
TSchemeClient schemeClient(MakeDriver());
40+
41+
auto describeResult = schemeClient.DescribePath(path).GetValueSync();
42+
NStatusHelpers::ThrowOnError(describeResult);
43+
auto entry = describeResult.GetEntry();
44+
45+
if (entry.Type == ESchemeEntryType::Table || entry.Type == ESchemeEntryType::ColumnTable) {
46+
TTableClient client(MakeDriver());
47+
NStatusHelpers::ThrowOnError(client.RetryOperationSync([&path](TSession session) {
48+
return session.DropTable(path).GetValueSync();
49+
}));
50+
} else if (entry.Type == ESchemeEntryType::Topic) {
51+
TTopicClient client(MakeDriver());
52+
NStatusHelpers::ThrowOnError(client.DropTopic(path).GetValueSync());
53+
} else if (entry.Type == ESchemeEntryType::Directory) {
54+
auto listResult = schemeClient.ListDirectory(path).GetValueSync();
55+
NStatusHelpers::ThrowOnError(listResult);
56+
for (const auto& entry : listResult.GetChildren()) {
57+
RemoveDirectoryRecurive(path + "/" + entry.Name);
58+
}
59+
} else {
60+
ythrow TYdbException() << "Entry type " << entry.Type << " is not supported" << Endl;
61+
}
62+
}
63+
64+
void TTopicTestFixture::TearDown() {
65+
RemoveDirectoryRecurive(GetDatabase() + "/" + TopicPrefix_);
66+
}
67+
3568
std::string TTopicTestFixture::GetEndpoint() const {
3669
auto endpoint = std::getenv("YDB_ENDPOINT");
3770
Y_ENSURE_BT(endpoint, "YDB_ENDPOINT is not set");

tests/integration/topic/setup/fixture.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ extern const bool EnableDirectRead;
1414
class TTopicTestFixture : public ::testing::Test, public ITopicTestSetup {
1515
public:
1616
void SetUp() override;
17+
void TearDown() override;
1718

1819
std::string GetEndpoint() const override;
1920
std::string GetDatabase() const override;
@@ -24,6 +25,8 @@ class TTopicTestFixture : public ::testing::Test, public ITopicTestSetup {
2425

2526
std::uint16_t GetPort() const override;
2627
std::vector<std::uint32_t> GetNodeIds() override;
28+
29+
void RemoveDirectoryRecurive(const std::string& path) const;
2730
};
2831

2932
}

0 commit comments

Comments
 (0)