aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpetrov02 <lpetrov02@yandex-team.com>2022-09-30 17:10:12 +0300
committerlpetrov02 <lpetrov02@yandex-team.com>2022-09-30 17:10:12 +0300
commit0febcae4fc6ab53f99de2c988afa15ee195d0f20 (patch)
treee61ec2221f1187a0ea0c3cec56d3ea1ee6c5954e
parent4c083af59b8fd8dc2ea702509f1cefdf4e85850d (diff)
downloadydb-0febcae4fc6ab53f99de2c988afa15ee195d0f20.tar.gz
Added tests for changing retention modes
Adds test for changing retention between modes
-rw-r--r--ydb/services/datastreams/datastreams_ut.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/ydb/services/datastreams/datastreams_ut.cpp b/ydb/services/datastreams/datastreams_ut.cpp
index e6dd56cb1f9..839adb01c34 100644
--- a/ydb/services/datastreams/datastreams_ut.cpp
+++ b/ydb/services/datastreams/datastreams_ut.cpp
@@ -882,6 +882,60 @@ Y_UNIT_TEST_SUITE(DataStreams) {
}
}
+ Y_UNIT_TEST(ChangeBetweenRetentionModes) {
+ TInsecureDatastreamsTestServer testServer;
+ const TString streamName = TStringBuilder() << "stream_" << Y_UNIT_TEST_NAME;
+
+ // CREATE STREAM IF NOT EXISTS
+ auto result = testServer.DataStreamsClient->CreateStream(streamName,
+ NYDS_V1::TCreateStreamSettings().ShardCount(10)
+ .RetentionStorageMegabytes(50_GB / 1_MB)).ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+
+ // UPDATE: Gb -> hours
+ auto updResult = testServer.DataStreamsClient->UpdateStream(streamName,
+ NYDS_V1::TUpdateStreamSettings().TargetShardCount(10)
+ .RetentionPeriodHours(4)).ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(updResult.IsTransportError(), false);
+ UNIT_ASSERT_VALUES_EQUAL(updResult.GetStatus(), EStatus::SUCCESS);
+
+ auto describeResult = testServer.DataStreamsClient->DescribeStream(streamName).ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.IsTransportError(), false);
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.GetStatus(), EStatus::SUCCESS);
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.GetResult().stream_description().retention_period_hours(),
+ TDuration::Hours(4).Hours());
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.GetResult().stream_description().storage_limit_mb(), 0);
+
+ // UPDATE #2: hours -> Gb
+ updResult = testServer.DataStreamsClient->UpdateStream(streamName,
+ NYDS_V1::TUpdateStreamSettings().TargetShardCount(10)
+ .RetentionStorageMegabytes(50_GB / 1_MB)).ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(updResult.IsTransportError(), false);
+ UNIT_ASSERT_VALUES_EQUAL(updResult.GetStatus(), EStatus::SUCCESS);
+
+ describeResult = testServer.DataStreamsClient->DescribeStream(streamName).ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.IsTransportError(), false);
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.GetStatus(), EStatus::SUCCESS);
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.GetResult().stream_description().retention_period_hours(),
+ TDuration::Days(7).Hours());
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.GetResult().stream_description().storage_limit_mb(), 50_GB / 1_MB);
+
+ // UPDATE #3: Gb -> hours
+ updResult = testServer.DataStreamsClient->UpdateStream(streamName,
+ NYDS_V1::TUpdateStreamSettings().TargetShardCount(10)
+ .RetentionPeriodHours(4)).ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(updResult.IsTransportError(), false);
+ UNIT_ASSERT_VALUES_EQUAL(updResult.GetStatus(), EStatus::SUCCESS);
+
+ describeResult = testServer.DataStreamsClient->DescribeStream(streamName).ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.IsTransportError(), false);
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.GetStatus(), EStatus::SUCCESS);
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.GetResult().stream_description().retention_period_hours(),
+ TDuration::Hours(4).Hours());
+ UNIT_ASSERT_VALUES_EQUAL(describeResult.GetResult().stream_description().storage_limit_mb(), 0);
+ }
+
Y_UNIT_TEST(TestCreateExistingStream) {
TInsecureDatastreamsTestServer testServer;
const TString streamName = TStringBuilder() << "stream_" << Y_UNIT_TEST_NAME;