Skip to content

Commit b71bea9

Browse files
authored
Add test for CDC topic control plane (#11899)
1 parent 38aef7d commit b71bea9

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

ydb/core/persqueue/ut/ut_with_sdk/autoscaling_ut.cpp

+86
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,92 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
10691069
}
10701070
}
10711071

1072+
Y_UNIT_TEST(ControlPlane_CDC_Enable) {
1073+
TTopicSdkTestSetup setup = CreateSetup();
1074+
auto tableClient = setup.MakeTableClient();
1075+
auto session = tableClient.CreateSession().GetValueSync().GetSession();
1076+
auto client = setup.MakeClient();
1077+
1078+
ExecuteQuery(session, R"(
1079+
--!syntax_v1
1080+
CREATE TABLE `/Root/origin` (
1081+
id Uint64,
1082+
value Text,
1083+
PRIMARY KEY (id)
1084+
);
1085+
)");
1086+
1087+
ExecuteQuery(session, R"(
1088+
--!syntax_v1
1089+
ALTER TABLE `/Root/origin`
1090+
ADD CHANGEFEED `feed` WITH (
1091+
MODE = 'UPDATES',
1092+
FORMAT = 'JSON',
1093+
TOPIC_AUTO_PARTITIONING = 'DISABLED'
1094+
);
1095+
)");
1096+
1097+
{
1098+
TAlterTopicSettings alterSettings;
1099+
alterSettings
1100+
.BeginAlterPartitioningSettings()
1101+
.MinActivePartitions(3)
1102+
.MaxActivePartitions(107)
1103+
.BeginAlterAutoPartitioningSettings()
1104+
.Strategy(EAutoPartitioningStrategy::ScaleUp)
1105+
.EndAlterAutoPartitioningSettings()
1106+
.EndAlterTopicPartitioningSettings();
1107+
auto f = client.AlterTopic("/Root/origin/feed", alterSettings);
1108+
f.Wait();
1109+
1110+
auto v = f.GetValueSync();
1111+
UNIT_ASSERT_C(!v.IsSuccess(), "Error: " << v);
1112+
}
1113+
}
1114+
1115+
Y_UNIT_TEST(ControlPlane_CDC_Disable) {
1116+
TTopicSdkTestSetup setup = CreateSetup();
1117+
auto tableClient = setup.MakeTableClient();
1118+
auto session = tableClient.CreateSession().GetValueSync().GetSession();
1119+
auto client = setup.MakeClient();
1120+
1121+
ExecuteQuery(session, R"(
1122+
--!syntax_v1
1123+
CREATE TABLE `/Root/origin` (
1124+
id Uint64,
1125+
value Text,
1126+
PRIMARY KEY (id)
1127+
);
1128+
)");
1129+
1130+
ExecuteQuery(session, R"(
1131+
--!syntax_v1
1132+
ALTER TABLE `/Root/origin`
1133+
ADD CHANGEFEED `feed` WITH (
1134+
MODE = 'UPDATES',
1135+
FORMAT = 'JSON',
1136+
TOPIC_AUTO_PARTITIONING = 'ENABLED'
1137+
);
1138+
)");
1139+
1140+
{
1141+
TAlterTopicSettings alterSettings;
1142+
alterSettings
1143+
.BeginAlterPartitioningSettings()
1144+
.MinActivePartitions(3)
1145+
.MaxActivePartitions(107)
1146+
.BeginAlterAutoPartitioningSettings()
1147+
.Strategy(EAutoPartitioningStrategy::Disabled)
1148+
.EndAlterAutoPartitioningSettings()
1149+
.EndAlterTopicPartitioningSettings();
1150+
auto f = client.AlterTopic("/Root/origin/feed", alterSettings);
1151+
f.Wait();
1152+
1153+
auto v = f.GetValueSync();
1154+
UNIT_ASSERT_C(!v.IsSuccess(), "Error: " << v);
1155+
}
1156+
}
1157+
10721158
Y_UNIT_TEST(BalancingAfterSplit_sessionsWithPartition) {
10731159
TTopicSdkTestSetup setup = CreateSetup();
10741160
setup.CreateTopicWithAutoscale(TEST_TOPIC, TEST_CONSUMER, 1, 100);

0 commit comments

Comments
 (0)