Skip to content

Commit f93ae16

Browse files
Merge 88d2740 into e6c8de4
2 parents e6c8de4 + 88d2740 commit f93ae16

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

ydb/core/tx/schemeshard/ut_restore/ut_restore.cpp

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5203,6 +5203,74 @@ Y_UNIT_TEST_SUITE(TImportTests) {
52035203
TestImportChangefeeds(3, AddedSchemeWithPermissions);
52045204
}
52055205

5206+
void TestCreateCdcStreams(TTestEnv& env, TTestActorRuntime& runtime, ui64& txId, const TString & dbName, ui64 count) {
5207+
for (ui64 i = 1; i <= count; ++i) {
5208+
TestCreateCdcStream(runtime, ++txId, dbName, Sprintf(R"(
5209+
TableName: "Original"
5210+
StreamDescription {
5211+
Name: "update_feed%d"
5212+
Mode: ECdcStreamModeKeysOnly
5213+
Format: ECdcStreamFormatProto
5214+
}
5215+
)", i));
5216+
env.TestWaitNotification(runtime, txId);
5217+
}
5218+
}
5219+
5220+
Y_UNIT_TEST(ChangefeedsExportRestore) {
5221+
TPortManager portManager;
5222+
const ui16 port = portManager.GetPort();
5223+
5224+
TS3Mock s3Mock({}, TS3Mock::TSettings(port));
5225+
UNIT_ASSERT(s3Mock.Start());
5226+
5227+
TTestBasicRuntime runtime;
5228+
TTestEnv env(runtime);
5229+
ui64 txId = 100;
5230+
5231+
runtime.SetLogPriority(NKikimrServices::DATASHARD_BACKUP, NActors::NLog::PRI_TRACE);
5232+
runtime.SetLogPriority(NKikimrServices::DATASHARD_RESTORE, NActors::NLog::PRI_TRACE);
5233+
runtime.SetLogPriority(NKikimrServices::EXPORT, NActors::NLog::PRI_TRACE);
5234+
runtime.SetLogPriority(NKikimrServices::IMPORT, NActors::NLog::PRI_TRACE);
5235+
5236+
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
5237+
Name: "Original"
5238+
Columns { Name: "key" Type: "Uint32" }
5239+
Columns { Name: "double_value" Type: "Double" }
5240+
Columns { Name: "float_value" Type: "Float" }
5241+
KeyColumnNames: ["key"]
5242+
)");
5243+
env.TestWaitNotification(runtime, txId);
5244+
5245+
TestCreateCdcStreams(env, runtime, ++txId, "/MyRoot", 3);
5246+
5247+
TestExport(runtime, ++txId, "/MyRoot", Sprintf(R"(
5248+
ExportToS3Settings {
5249+
endpoint: "localhost:%d"
5250+
scheme: HTTP
5251+
items {
5252+
source_path: "/MyRoot/Original"
5253+
destination_prefix: ""
5254+
}
5255+
}
5256+
)", port));
5257+
env.TestWaitNotification(runtime, txId);
5258+
TestGetExport(runtime, txId, "/MyRoot");
5259+
5260+
TestImport(runtime, ++txId, "/MyRoot", Sprintf(R"(
5261+
ImportFromS3Settings {
5262+
endpoint: "localhost:%d"
5263+
scheme: HTTP
5264+
items {
5265+
source_prefix: ""
5266+
destination_path: "/MyRoot/Restored"
5267+
}
5268+
}
5269+
)", port));
5270+
env.TestWaitNotification(runtime, txId);
5271+
TestGetImport(runtime, txId, "/MyRoot");
5272+
}
5273+
52065274
Y_UNIT_TEST(IgnoreBasicSchemeLimits) {
52075275
TTestBasicRuntime runtime;
52085276
TTestEnv env(runtime);

0 commit comments

Comments
 (0)