Skip to content

Commit 7edda8c

Browse files
TestData
1 parent 78bfed9 commit 7edda8c

File tree

1 file changed

+61
-96
lines changed

1 file changed

+61
-96
lines changed

ydb/core/tx/schemeshard/ut_export_reboots_s3/ut_export_reboots_s3.cpp

Lines changed: 61 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -440,111 +440,76 @@ Y_UNIT_TEST_SUITE(TExportToS3WithRebootsTests) {
440440
)");
441441
}
442442

443-
Y_UNIT_TEST(ShouldSucceedOnSingleShardTableWithChangefeed) {
444-
const char* tableName = "Table";
445-
RunS3({
446-
TTypedScheme {
447-
Sprintf(R"(
448-
Name: "%s"
449-
Columns { Name: "key" Type: "Utf8" }
450-
Columns { Name: "value" Type: "Utf8" }
451-
KeyColumnNames: ["key"]
452-
)", tableName),
453-
EPathTypeTable
454-
},
455-
TTypedScheme {
456-
Sprintf(R"(
457-
TableName: "%s"
458-
StreamDescription {
459-
Name: "update_feed"
460-
Mode: ECdcStreamModeUpdate
461-
Format: ECdcStreamFormatJson
462-
State: ECdcStreamStateReady
463-
}
464-
)", tableName),
465-
EPathTypeCdcStream
443+
class TestData {
444+
public:
445+
static const TTypedScheme& Table() const {
446+
return TableScheme;
447+
}
448+
449+
static const TTypedScheme& Changefeed() const {
450+
return ChangefeedScheme;
451+
}
452+
453+
static const TString& Request() const {
454+
return request;
455+
}
456+
457+
private:
458+
static const char* TableName = "Table";
459+
460+
static const TTypedScheme TableScheme = TTypedScheme {
461+
Sprintf(R"(
462+
Name: "%s"
463+
Columns { Name: "key" Type: "Utf8" }
464+
Columns { Name: "value" Type: "Utf8" }
465+
KeyColumnNames: ["key"]
466+
)", tableName),
467+
EPathTypeTable
468+
};
469+
470+
static const TTypedScheme ChangefeedScheme = TTypedScheme {
471+
Sprintf(R"(
472+
TableName: "%s"
473+
StreamDescription {
474+
Name: "update_feed"
475+
Mode: ECdcStreamModeUpdate
476+
Format: ECdcStreamFormatJson
477+
State: ECdcStreamStateReady
466478
}
467-
}, R"(
468-
ExportToS3Settings {
469-
endpoint: "localhost:%d"
470-
scheme: HTTP
471-
items {
472-
source_path: "/MyRoot/Table"
473-
destination_prefix: ""
474-
}
479+
)", tableName),
480+
EPathTypeCdcStream
481+
};
482+
483+
static const TString request = R"(
484+
ExportToS3Settings {
485+
endpoint: "localhost:%d"
486+
scheme: HTTP
487+
items {
488+
source_path: "/MyRoot/Table"
489+
destination_prefix: ""
475490
}
476-
)");
491+
}
492+
)";
493+
};
494+
495+
Y_UNIT_TEST(ShouldSucceedOnSingleShardTableWithChangefeed) {
496+
RunS3({
497+
TestData::Table(),
498+
TestData::Changefeed()
499+
}, TestData::Request());
477500
}
478501

479502
Y_UNIT_TEST(CancelOnSingleShardTableWithChangefeed) {
480-
const char* tableName = "Table";
481503
CancelS3({
482-
TTypedScheme {
483-
Sprintf(R"(
484-
Name: "%s"
485-
Columns { Name: "key" Type: "Utf8" }
486-
Columns { Name: "value" Type: "Utf8" }
487-
KeyColumnNames: ["key"]
488-
)", tableName),
489-
EPathTypeTable
490-
},
491-
TTypedScheme {
492-
Sprintf(R"(
493-
TableName: "%s"
494-
StreamDescription {
495-
Name: "update_feed"
496-
Mode: ECdcStreamModeUpdate
497-
Format: ECdcStreamFormatJson
498-
State: ECdcStreamStateReady
499-
}
500-
)", tableName),
501-
EPathTypeCdcStream
502-
}
503-
}, R"(
504-
ExportToS3Settings {
505-
endpoint: "localhost:%d"
506-
scheme: HTTP
507-
items {
508-
source_path: "/MyRoot/Table"
509-
destination_prefix: ""
510-
}
511-
}
512-
)");
504+
TestData::Table(),
505+
TestData::Changefeed()
506+
}, TestData::Request());
513507
}
514508

515509
Y_UNIT_TEST(ForgetShouldSucceedOnSingleShardTableWithChangefeed) {
516-
const char* tableName = "Table";
517510
ForgetS3({
518-
TTypedScheme {
519-
Sprintf(R"(
520-
Name: "%s"
521-
Columns { Name: "key" Type: "Utf8" }
522-
Columns { Name: "value" Type: "Utf8" }
523-
KeyColumnNames: ["key"]
524-
)", tableName),
525-
EPathTypeTable
526-
},
527-
TTypedScheme {
528-
Sprintf(R"(
529-
TableName: "%s"
530-
StreamDescription {
531-
Name: "update_feed"
532-
Mode: ECdcStreamModeUpdate
533-
Format: ECdcStreamFormatJson
534-
State: ECdcStreamStateReady
535-
}
536-
)", tableName),
537-
EPathTypeCdcStream
538-
}
539-
}, R"(
540-
ExportToS3Settings {
541-
endpoint: "localhost:%d"
542-
scheme: HTTP
543-
items {
544-
source_path: "/MyRoot/Table"
545-
destination_prefix: ""
546-
}
547-
}
548-
)");
511+
TestData::Table(),
512+
TestData::Changefeed()
513+
}, TestData::Request());
549514
}
550515
}

0 commit comments

Comments
 (0)