@@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
3737
3838 void SimpleTest (bool autoscaleAwareSDK) {
3939 TTopicSdkTestSetup setup = CreateSetup ();
40- setup.CreateTopic ();
40+ setup.CreateTopicWithAutoscale ();
4141
4242 TTopicClient client = setup.MakeClient ();
4343
@@ -79,7 +79,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
7979
8080 void ReadingAfterSplitTest (bool autoscaleAwareSDK, bool autoCommit) {
8181 TTopicSdkTestSetup setup = CreateSetup ();
82- setup.CreateTopic ();
82+ setup.CreateTopicWithAutoscale ();
8383
8484 TTopicClient client = setup.MakeClient ();
8585
@@ -133,7 +133,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
133133
134134 void ReadingAfterSplitTest_PreferedPartition (bool autoscaleAwareSDK) {
135135 TTopicSdkTestSetup setup = CreateSetup ();
136- setup.CreateTopic ();
136+ setup.CreateTopicWithAutoscale ();
137137
138138 TTopicClient client = setup.MakeClient ();
139139
@@ -179,7 +179,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
179179
180180 Y_UNIT_TEST (PartitionSplit_BeforeAutoscaleAwareSDK) {
181181 TTopicSdkTestSetup setup = CreateSetup ();
182- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
182+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
183183
184184 TTopicClient client = setup.MakeClient ();
185185
@@ -226,7 +226,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
226226
227227 Y_UNIT_TEST (PartitionSplit_AutoscaleAwareSDK) {
228228 TTopicSdkTestSetup setup = CreateSetup ();
229- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
229+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
230230
231231 TTopicClient client = setup.MakeClient ();
232232
@@ -271,7 +271,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
271271
272272 void PartitionSplit_PreferedPartition (bool autoscaleAwareSDK) {
273273 TTopicSdkTestSetup setup = CreateSetup ();
274- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
274+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
275275
276276 TTopicClient client = setup.MakeClient ();
277277
@@ -348,7 +348,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
348348
349349 void PartitionMerge_PreferedPartition (bool autoscaleAwareSDK) {
350350 TTopicSdkTestSetup setup = CreateSetup ();
351- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 2 , 100 );
351+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 2 , 100 );
352352
353353 TTopicClient client = setup.MakeClient ();
354354
@@ -416,7 +416,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
416416
417417 void PartitionSplit_ReadEmptyPartitions (bool autoscaleAwareSDK) {
418418 TTopicSdkTestSetup setup = CreateSetup ();
419- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
419+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
420420
421421 TTopicClient client = setup.MakeClient ();
422422 TTestReadSession readSession (" session-0" , client, Max<size_t >(), false , {}, autoscaleAwareSDK);
@@ -441,7 +441,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
441441
442442 Y_UNIT_TEST (PartitionSplit_ReadNotEmptyPartitions_BeforeAutoscaleAwareSDK) {
443443 TTopicSdkTestSetup setup = CreateSetup ();
444- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
444+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
445445
446446 TTopicClient client = setup.MakeClient ();
447447 TTestReadSession readSession (" Session-0" , client, Max<size_t >(), false , {}, false );
@@ -468,7 +468,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
468468
469469 Y_UNIT_TEST (PartitionSplit_ReadNotEmptyPartitions_AutoscaleAwareSDK) {
470470 TTopicSdkTestSetup setup = CreateSetup ();
471- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
471+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
472472
473473 TTopicClient client = setup.MakeClient ();
474474 TTestReadSession readSession (" Session-0" , client, Max<size_t >(), false , {}, true );
@@ -489,7 +489,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
489489
490490 Y_UNIT_TEST (PartitionSplit_ManySession_BeforeAutoscaleAwareSDK) {
491491 TTopicSdkTestSetup setup = CreateSetup ();
492- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
492+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
493493
494494 TTopicClient client = setup.MakeClient ();
495495
@@ -521,7 +521,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
521521
522522 Y_UNIT_TEST (PartitionSplit_ManySession_AutoscaleAwareSDK) {
523523 TTopicSdkTestSetup setup = CreateSetup ();
524- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
524+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
525525
526526 TTopicClient client = setup.MakeClient ();
527527
@@ -566,7 +566,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
566566
567567 Y_UNIT_TEST (PartitionSplit_ManySession_existed_AutoscaleAwareSDK) {
568568 TTopicSdkTestSetup setup = CreateSetup ();
569- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
569+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
570570
571571 TTopicClient client = setup.MakeClient ();
572572
@@ -594,7 +594,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
594594
595595 Y_UNIT_TEST (CommitTopPast_BeforeAutoscaleAwareSDK) {
596596 TTopicSdkTestSetup setup = CreateSetup ();
597- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
597+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
598598
599599 TTopicClient client = setup.MakeClient ();
600600
@@ -692,6 +692,57 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
692692 UNIT_ASSERT_VALUES_EQUAL (describeAfterAlter.GetTopicDescription ().GetPartitioningSettings ().GetAutoscalingSettings ().GetThresholdTime ().Seconds (), alterThreshold);
693693 }
694694
695+ Y_UNIT_TEST (ControlPlane_DisableAutoPartitioning) {
696+ auto topicName = " autoscalit-topic" ;
697+
698+ TTopicSdkTestSetup setup = CreateSetup ();
699+ TTopicClient client = setup.MakeClient ();
700+
701+ {
702+ TCreateTopicSettings createSettings;
703+ createSettings
704+ .BeginConfigurePartitioningSettings ()
705+ .MinActivePartitions (1 )
706+ .MaxActivePartitions (100 )
707+ .BeginConfigureAutoscalingSettings ()
708+ .Strategy (EAutoscalingStrategy::ScaleUp)
709+ .EndConfigureAutoscalingSettings ()
710+ .EndConfigurePartitioningSettings ();
711+ client.CreateTopic (topicName, createSettings).Wait ();
712+ }
713+
714+ {
715+ TAlterTopicSettings alterSettings;
716+ alterSettings
717+ .BeginAlterPartitioningSettings ()
718+ .BeginAlterAutoscalingSettings ()
719+ .Strategy (EAutoscalingStrategy::Disabled)
720+ .EndAlterAutoscalingSettings ()
721+ .EndAlterTopicPartitioningSettings ();
722+ auto f = client.AlterTopic (topicName, alterSettings);
723+ f.Wait ();
724+
725+ auto v = f.GetValueSync ();
726+ UNIT_ASSERT_C (!v.IsSuccess (), " Must receve error becuse max-partition is not 0" );
727+ }
728+
729+ {
730+ TAlterTopicSettings alterSettings;
731+ alterSettings
732+ .BeginAlterPartitioningSettings ()
733+ .MaxActivePartitions (0 )
734+ .BeginAlterAutoscalingSettings ()
735+ .Strategy (EAutoscalingStrategy::Disabled)
736+ .EndAlterAutoscalingSettings ()
737+ .EndAlterTopicPartitioningSettings ();
738+ auto f = client.AlterTopic (topicName, alterSettings);
739+ f.Wait ();
740+
741+ auto v = f.GetValueSync ();
742+ UNIT_ASSERT_C (v.IsSuccess (), " Error: " << v);
743+ }
744+ }
745+
695746 Y_UNIT_TEST (ControlPlane_AutoscalingWithStorageSizeRetention) {
696747 auto autoscalingTestTopic = " autoscalit-topic" ;
697748 TTopicSdkTestSetup setup = CreateSetup ();
0 commit comments