Skip to content

Commit 9a56e86

Browse files
authored
25-1-2: Fix ut_move_reboots tests, remove copy-paste (#19747)
2 parents 05ccfa6 + f43b046 commit 9a56e86

File tree

4 files changed

+17
-96
lines changed

4 files changed

+17
-96
lines changed

ydb/core/testlib/basics/feature_flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class TTestFeatureFlagsHolder {
7676
FEATURE_FLAG_SETTER(EnableStrictUserManagement)
7777
FEATURE_FLAG_SETTER(EnableDatabaseAdmin)
7878
FEATURE_FLAG_SETTER(EnablePermissionsExport)
79+
FEATURE_FLAG_SETTER(EnableLocalDBBtreeIndex)
7980

8081
#undef FEATURE_FLAG_SETTER
8182
};

ydb/core/tx/schemeshard/ut_helpers/test_env.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime& runtime, const TTe
609609
app.SetEnableChecksumsExport(opts.EnableChecksumsExport_);
610610
app.SetEnableTopicTransfer(opts.EnableTopicTransfer_);
611611
app.SetEnablePermissionsExport(opts.EnablePermissionsExport_);
612+
app.SetEnableLocalDBBtreeIndex(opts.EnableLocalDBBtreeIndex_);
612613

613614
app.ColumnShardConfig.SetDisabledOnSchemeShard(false);
614615

ydb/core/tx/schemeshard/ut_helpers/test_env.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ namespace NSchemeShardUT_Private {
7777
OPTION(std::optional<bool>, EnableDatabaseAdmin, std::nullopt);
7878
OPTION(std::optional<bool>, EnablePermissionsExport, std::nullopt);
7979
OPTION(std::optional<bool>, EnableChecksumsExport, std::nullopt);
80+
OPTION(std::optional<bool>, EnableLocalDBBtreeIndex, std::nullopt);
8081
OPTION(TVector<TIntrusivePtr<NFake::TProxyDS>>, DSProxies, {});
8182

8283
#undef OPTION

ydb/core/tx/schemeshard/ut_move_reboots/ut_move_reboots.cpp

Lines changed: 14 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveRebootsTest) {
1616
TTestEnv env(runtime);
1717
}
1818

19-
Y_UNIT_TEST(WithData) {
19+
void WithData(bool enablePersistentPartitionStats, bool enableLocalDBBtreeIndex) {
2020
TTestWithReboots t;
21+
t.GetTestEnvOptions()
22+
.EnableLocalDBBtreeIndex(enableLocalDBBtreeIndex)
23+
.EnablePersistentPartitionStats(enablePersistentPartitionStats);
2124

2225
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
2326
TPathVersion pathVersion;
@@ -72,7 +75,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveRebootsTest) {
7275
}
7376

7477
TestDescribeResult(DescribePath(runtime, "/MyRoot"),
75-
{NLs::DatabaseSizeIs(120)});
78+
{NLs::DatabaseSizeIs(enableLocalDBBtreeIndex ? 58 : 120)});
7679

7780
}
7881

@@ -104,106 +107,21 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveRebootsTest) {
104107
}
105108

106109
TestDescribeResult(DescribePath(runtime, "/MyRoot"),
107-
{NLs::DatabaseSizeIs(120)});
110+
{NLs::DatabaseSizeIs(enableLocalDBBtreeIndex ? 58 : 120)});
108111
}
109112
});
110113
}
111114

112-
Y_UNIT_TEST(WithDataAndPersistentPartitionStats) {
113-
TTestWithReboots t;
114-
t.GetTestEnvOptions().EnablePersistentPartitionStats(true);
115-
116-
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
117-
TPathVersion pathVersion;
118-
{
119-
TInactiveZone inactive(activeZone);
120-
TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
121-
Name: "Table"
122-
Columns { Name: "key" Type: "Uint64" }
123-
Columns { Name: "value" Type: "Utf8" }
124-
KeyColumnNames: ["key"]
125-
)");
126-
t.TestEnv->TestWaitNotification(runtime, t.TxId);
127-
128-
// Write some data to the user table
129-
auto fnWriteRow = [&] (ui64 tabletId) {
130-
TString writeQuery = R"(
131-
(
132-
(let key '( '('key (Uint64 '0)) ) )
133-
(let value '('('value (Utf8 '281474980010683)) ) )
134-
(return (AsList (UpdateRow '__user__Table key value) ))
135-
)
136-
)";
137-
NKikimrMiniKQL::TResult result;
138-
TString err;
139-
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
140-
UNIT_ASSERT_VALUES_EQUAL(err, "");
141-
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
142-
};
143-
fnWriteRow(TTestTxConfig::FakeHiveTablets);
144-
145-
pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
146-
{NLs::PathExist,
147-
NLs::ChildrenCount(2),
148-
NLs::ShardsInsideDomain(1)});
149-
150-
auto tableVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
151-
{NLs::PathExist});
152-
{
153-
const auto result = CompactTable(runtime, TTestTxConfig::FakeHiveTablets, tableVersion.PathId);
154-
UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), NKikimrTxDataShard::TEvCompactTableResult::OK);
155-
}
156-
157-
{ //wait stats
158-
TVector<THolder<IEventHandle>> suppressed;
159-
auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
160-
161-
WaitForSuppressed(runtime, suppressed, 1, prevObserver);
162-
for (auto &msg : suppressed) {
163-
runtime.Send(msg.Release());
164-
}
165-
suppressed.clear();
166-
}
167-
168-
TestDescribeResult(DescribePath(runtime, "/MyRoot"),
169-
{NLs::DatabaseSizeIs(120)});
170-
171-
}
172-
173-
t.TestEnv->ReliablePropose(runtime, MoveTableRequest(++t.TxId, "/MyRoot/Table", "/MyRoot/TableMove", TTestTxConfig::SchemeShard, {pathVersion}),
174-
{NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
175-
176-
TestDescribeResult(DescribePath(runtime, "/MyRoot"),
177-
{NLs::DatabaseSizeIs(120)});
178-
179-
t.TestEnv->TestWaitNotification(runtime, t.TxId);
180-
181-
{
182-
TInactiveZone inactive(activeZone);
183-
TestDescribeResult(DescribePath(runtime, "/MyRoot"),
184-
{NLs::ChildrenCount(2),
185-
NLs::ShardsInsideDomain(1)});
186-
TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
187-
{NLs::PathVersionEqual(5),
188-
NLs::IsTable});
189-
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
190-
{NLs::PathNotExist});
191-
192-
{ //wait stats
193-
TVector<THolder<IEventHandle>> suppressed;
194-
auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
115+
Y_UNIT_TEST(WithData) {
116+
WithData(false, false);
117+
}
195118

196-
WaitForSuppressed(runtime, suppressed, 1, prevObserver);
197-
for (auto &msg : suppressed) {
198-
runtime.Send(msg.Release());
199-
}
200-
suppressed.clear();
201-
}
119+
Y_UNIT_TEST(WithDataAndPersistentPartitionStats) {
120+
WithData(true, false);
121+
}
202122

203-
TestDescribeResult(DescribePath(runtime, "/MyRoot"),
204-
{NLs::DatabaseSizeIs(120)});
205-
}
206-
});
123+
Y_UNIT_TEST(WithDataAndLocalDBBtreeIndex) {
124+
WithData(false, true);
207125
}
208126

209127
Y_UNIT_TEST(MoveIndex) {

0 commit comments

Comments
 (0)