diff options
author | Ilnaz Nizametdinov <[email protected]> | 2025-06-17 15:39:40 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2025-06-17 12:39:40 +0000 |
commit | 9c5a99edfa714f6e85002c2e691f7a5741bb9402 (patch) | |
tree | b78db45ce7ae8d09e3a138922f063e2e2207a209 | |
parent | 889c6906791d9a4c3a0b7f13c4745247cec2f285 (diff) |
Fix ut_move_reboots tests, remove copy-paste (#19726)
-rw-r--r-- | ydb/core/testlib/basics/feature_flags.h | 1 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/ut_helpers/test_env.cpp | 1 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/ut_helpers/test_env.h | 1 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/ut_move_reboots/ut_move_reboots.cpp | 110 |
4 files changed, 17 insertions, 96 deletions
diff --git a/ydb/core/testlib/basics/feature_flags.h b/ydb/core/testlib/basics/feature_flags.h index 9992dde5635..5a9e4d68b08 100644 --- a/ydb/core/testlib/basics/feature_flags.h +++ b/ydb/core/testlib/basics/feature_flags.h @@ -77,6 +77,7 @@ public: FEATURE_FLAG_SETTER(EnableDatabaseAdmin) FEATURE_FLAG_SETTER(EnablePermissionsExport) FEATURE_FLAG_SETTER(EnableShowCreate) + FEATURE_FLAG_SETTER(EnableLocalDBBtreeIndex) #undef FEATURE_FLAG_SETTER }; diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp index d47b0bbe669..18ef1be1609 100644 --- a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp +++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp @@ -614,6 +614,7 @@ NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime& runtime, const TTe app.SetEnableChecksumsExport(opts.EnableChecksumsExport_); app.SetEnableTopicTransfer(opts.EnableTopicTransfer_); app.SetEnablePermissionsExport(opts.EnablePermissionsExport_); + app.SetEnableLocalDBBtreeIndex(opts.EnableLocalDBBtreeIndex_); app.ColumnShardConfig.SetDisabledOnSchemeShard(false); diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.h b/ydb/core/tx/schemeshard/ut_helpers/test_env.h index 2d7aa6629a3..94ed674a728 100644 --- a/ydb/core/tx/schemeshard/ut_helpers/test_env.h +++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.h @@ -77,6 +77,7 @@ namespace NSchemeShardUT_Private { OPTION(std::optional<bool>, EnableDatabaseAdmin, std::nullopt); OPTION(std::optional<bool>, EnablePermissionsExport, std::nullopt); OPTION(std::optional<bool>, EnableChecksumsExport, std::nullopt); + OPTION(std::optional<bool>, EnableLocalDBBtreeIndex, std::nullopt); OPTION(TVector<TIntrusivePtr<NFake::TProxyDS>>, DSProxies, {}); #undef OPTION diff --git a/ydb/core/tx/schemeshard/ut_move_reboots/ut_move_reboots.cpp b/ydb/core/tx/schemeshard/ut_move_reboots/ut_move_reboots.cpp index 12cd3cad938..fa2a38ebd3b 100644 --- a/ydb/core/tx/schemeshard/ut_move_reboots/ut_move_reboots.cpp +++ b/ydb/core/tx/schemeshard/ut_move_reboots/ut_move_reboots.cpp @@ -16,8 +16,11 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveRebootsTest) { TTestEnv env(runtime); } - Y_UNIT_TEST(WithData) { + void WithData(bool enablePersistentPartitionStats, bool enableLocalDBBtreeIndex) { TTestWithReboots t; + t.GetTestEnvOptions() + .EnableLocalDBBtreeIndex(enableLocalDBBtreeIndex) + .EnablePersistentPartitionStats(enablePersistentPartitionStats); t.Run([&](TTestActorRuntime& runtime, bool& activeZone) { TPathVersion pathVersion; @@ -72,7 +75,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveRebootsTest) { } TestDescribeResult(DescribePath(runtime, "/MyRoot"), - {NLs::DatabaseSizeIs(120)}); + {NLs::DatabaseSizeIs(enableLocalDBBtreeIndex ? 58 : 120)}); } @@ -104,106 +107,21 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveRebootsTest) { } TestDescribeResult(DescribePath(runtime, "/MyRoot"), - {NLs::DatabaseSizeIs(120)}); + {NLs::DatabaseSizeIs(enableLocalDBBtreeIndex ? 58 : 120)}); } }); } - Y_UNIT_TEST(WithDataAndPersistentPartitionStats) { - TTestWithReboots t; - t.GetTestEnvOptions().EnablePersistentPartitionStats(true); - - t.Run([&](TTestActorRuntime& runtime, bool& activeZone) { - TPathVersion pathVersion; - { - TInactiveZone inactive(activeZone); - TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"( - Name: "Table" - Columns { Name: "key" Type: "Uint64" } - Columns { Name: "value" Type: "Utf8" } - KeyColumnNames: ["key"] - )"); - t.TestEnv->TestWaitNotification(runtime, t.TxId); - - // Write some data to the user table - auto fnWriteRow = [&] (ui64 tabletId) { - TString writeQuery = R"( - ( - (let key '( '('key (Uint64 '0)) ) ) - (let value '('('value (Utf8 '281474980010683)) ) ) - (return (AsList (UpdateRow '__user__Table key value) )) - ) - )"; - NKikimrMiniKQL::TResult result; - TString err; - NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err); - UNIT_ASSERT_VALUES_EQUAL(err, ""); - UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);; - }; - fnWriteRow(TTestTxConfig::FakeHiveTablets); - - pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"), - {NLs::PathExist, - NLs::ChildrenCount(2), - NLs::ShardsInsideDomain(1)}); - - auto tableVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"), - {NLs::PathExist}); - { - const auto result = CompactTable(runtime, TTestTxConfig::FakeHiveTablets, tableVersion.PathId); - UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), NKikimrTxDataShard::TEvCompactTableResult::OK); - } - - { //wait stats - TVector<THolder<IEventHandle>> suppressed; - auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType); - - WaitForSuppressed(runtime, suppressed, 1, prevObserver); - for (auto &msg : suppressed) { - runtime.Send(msg.Release()); - } - suppressed.clear(); - } - - TestDescribeResult(DescribePath(runtime, "/MyRoot"), - {NLs::DatabaseSizeIs(120)}); - - } - - t.TestEnv->ReliablePropose(runtime, MoveTableRequest(++t.TxId, "/MyRoot/Table", "/MyRoot/TableMove", TTestTxConfig::SchemeShard, {pathVersion}), - {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed}); - - TestDescribeResult(DescribePath(runtime, "/MyRoot"), - {NLs::DatabaseSizeIs(120)}); - - t.TestEnv->TestWaitNotification(runtime, t.TxId); - - { - TInactiveZone inactive(activeZone); - TestDescribeResult(DescribePath(runtime, "/MyRoot"), - {NLs::ChildrenCount(2), - NLs::ShardsInsideDomain(1)}); - TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"), - {NLs::PathVersionEqual(5), - NLs::IsTable}); - TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"), - {NLs::PathNotExist}); - - { //wait stats - TVector<THolder<IEventHandle>> suppressed; - auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType); + Y_UNIT_TEST(WithData) { + WithData(false, false); + } - WaitForSuppressed(runtime, suppressed, 1, prevObserver); - for (auto &msg : suppressed) { - runtime.Send(msg.Release()); - } - suppressed.clear(); - } + Y_UNIT_TEST(WithDataAndPersistentPartitionStats) { + WithData(true, false); + } - TestDescribeResult(DescribePath(runtime, "/MyRoot"), - {NLs::DatabaseSizeIs(120)}); - } - }); + Y_UNIT_TEST(WithDataAndLocalDBBtreeIndex) { + WithData(false, true); } Y_UNIT_TEST(MoveIndex) { |