Skip to content

Commit 704225d

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

File tree

9 files changed

+453
-392
lines changed

9 files changed

+453
-392
lines changed

CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
"outputOnFailure": true
116116
},
117117
"execution": {
118-
"timeout": 1200
118+
"timeout": 600
119119
}
120120
},
121121
{

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: 45 additions & 4 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,20 +22,57 @@ 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();
3033

31-
client.DropTopic(GetTopicPath()).GetValueSync();
34+
RemoveDirectoryRecurive(GetDatabase() + "/" + TopicPrefix_);
35+
3236
CreateTopic();
3337
}
3438

39+
void TTopicTestFixture::RemoveDirectoryRecurive(const std::string& path) const {
40+
TSchemeClient schemeClient(MakeDriver());
41+
42+
auto describeResult = schemeClient.DescribePath(path).GetValueSync();
43+
if (describeResult.GetStatus() == EStatus::SCHEME_ERROR) {
44+
return;
45+
}
46+
NStatusHelpers::ThrowOnError(describeResult);
47+
auto entry = describeResult.GetEntry();
48+
49+
if (entry.Type == ESchemeEntryType::Table || entry.Type == ESchemeEntryType::ColumnTable) {
50+
TTableClient client(MakeDriver());
51+
NStatusHelpers::ThrowOnError(client.RetryOperationSync([&path](TSession session) {
52+
return session.DropTable(path).GetValueSync();
53+
}));
54+
} else if (entry.Type == ESchemeEntryType::Topic) {
55+
TTopicClient client(MakeDriver());
56+
NStatusHelpers::ThrowOnError(client.DropTopic(path).GetValueSync());
57+
} else if (entry.Type == ESchemeEntryType::Directory) {
58+
auto listResult = schemeClient.ListDirectory(path).GetValueSync();
59+
NStatusHelpers::ThrowOnError(listResult);
60+
for (const auto& entry : listResult.GetChildren()) {
61+
RemoveDirectoryRecurive(path + "/" + entry.Name);
62+
}
63+
} else {
64+
ythrow TYdbException() << "Entry type " << entry.Type << " is not supported" << Endl;
65+
}
66+
}
67+
68+
void TTopicTestFixture::TearDown() {
69+
// try {
70+
// RemoveDirectoryRecurive(GetDatabase() + "/" + TopicPrefix_);
71+
// } catch (const std::exception& e) {
72+
// std::cerr << "Occurred error in TearDown: " << e.what() << std::endl;
73+
// }
74+
}
75+
3576
std::string TTopicTestFixture::GetEndpoint() const {
3677
auto endpoint = std::getenv("YDB_ENDPOINT");
3778
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)