@@ -446,6 +446,15 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
446
446
UNIT_ASSERT_VALUES_EQUAL (issueVdiscCount, issueVdiscNumber);
447
447
}
448
448
449
+ bool HasTabletIssue (const Ydb::Monitoring::SelfCheckResult& result) {
450
+ for (const auto & issue_log : result.issue_log ()) {
451
+ if (issue_log.level () == 4 && issue_log.type () == " TABLET" ) {
452
+ return true ;
453
+ }
454
+ }
455
+ return false ;
456
+ }
457
+
449
458
void ListingTest (int const groupNumber, int const vdiscPerGroupNumber, bool const isMergeRecords = false ) {
450
459
auto result = RequestHc (groupNumber, vdiscPerGroupNumber, isMergeRecords);
451
460
CheckHcResult (result, groupNumber, vdiscPerGroupNumber, isMergeRecords);
@@ -865,6 +874,15 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
865
874
}
866
875
}
867
876
877
+ void AddBadServerlessTablet (TEvHive::TEvResponseHiveInfo::TPtr* ev) {
878
+ auto &record = (*ev)->Get ()->Record ;
879
+ auto * tablet = record.MutableTablets ()->Add ();
880
+ tablet->SetTabletID (1 );
881
+ tablet->MutableObjectDomain ()->SetSchemeShard (SERVERLESS_DOMAIN_KEY.OwnerId );
882
+ tablet->MutableObjectDomain ()->SetPathId (SERVERLESS_DOMAIN_KEY.LocalPathId );
883
+ tablet->SetRestartsPerPeriod (500 );
884
+ }
885
+
868
886
Y_UNIT_TEST (SpecificServerless) {
869
887
TPortManager tp;
870
888
ui16 port = tp.GetPort (2134 );
@@ -1164,6 +1182,102 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
1164
1182
UNIT_ASSERT (!databaseFoundInResult);
1165
1183
}
1166
1184
1185
+ Y_UNIT_TEST (ServerlessBadTablets) {
1186
+ TPortManager tp;
1187
+ ui16 port = tp.GetPort (2134 );
1188
+ ui16 grpcPort = tp.GetPort (2135 );
1189
+ auto settings = TServerSettings (port)
1190
+ .SetNodeCount (1 )
1191
+ .SetDynamicNodeCount (1 )
1192
+ .SetUseRealThreads (false )
1193
+ .SetDomainName (" Root" );
1194
+ TServer server (settings);
1195
+ server.EnableGRpc (grpcPort);
1196
+ TClient client (settings);
1197
+ TTestActorRuntime& runtime = *server.GetRuntime ();
1198
+
1199
+ auto &dynamicNameserviceConfig = runtime.GetAppData ().DynamicNameserviceConfig ;
1200
+ dynamicNameserviceConfig->MaxStaticNodeId = runtime.GetNodeId (server.StaticNodes () - 1 );
1201
+ dynamicNameserviceConfig->MinDynamicNodeId = runtime.GetNodeId (server.StaticNodes ());
1202
+ dynamicNameserviceConfig->MaxDynamicNodeId = runtime.GetNodeId (server.StaticNodes () + server.DynamicNodes () - 1 );
1203
+
1204
+ ui32 sharedDynNodeId = runtime.GetNodeId (1 );
1205
+
1206
+ bool firstConsoleResponse = true ;
1207
+ auto observerFunc = [&](TAutoPtr<IEventHandle>& ev) {
1208
+ switch (ev->GetTypeRewrite ()) {
1209
+ case NConsole::TEvConsole::EvListTenantsResponse: {
1210
+ auto *x = reinterpret_cast <NConsole::TEvConsole::TEvListTenantsResponse::TPtr*>(&ev);
1211
+ AddPathsToListTenantsResponse (x, { " /Root/serverless" , " /Root/shared" });
1212
+ break ;
1213
+ }
1214
+ case NConsole::TEvConsole::EvGetTenantStatusResponse: {
1215
+ auto *x = reinterpret_cast <NConsole::TEvConsole::TEvGetTenantStatusResponse::TPtr*>(&ev);
1216
+ if (!firstConsoleResponse) {
1217
+ ChangeGetTenantStatusResponse (x, " /Root/serverless" );
1218
+ } else {
1219
+ firstConsoleResponse = false ;
1220
+ ChangeGetTenantStatusResponse (x, " /Root/shared" );
1221
+ }
1222
+ break ;
1223
+ }
1224
+ case TEvTxProxySchemeCache::EvNavigateKeySetResult: {
1225
+ auto *x = reinterpret_cast <TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr*>(&ev);
1226
+ ChangeNavigateKeyResultServerless (x, NKikimrSubDomains::EServerlessComputeResourcesModeShared, runtime);
1227
+ break ;
1228
+ }
1229
+ case TEvHive::EvResponseHiveNodeStats: {
1230
+ auto *x = reinterpret_cast <TEvHive::TEvResponseHiveNodeStats::TPtr*>(&ev);
1231
+ ChangeResponseHiveNodeStats (x, sharedDynNodeId);
1232
+ break ;
1233
+ }
1234
+ case TEvHive::EvResponseHiveInfo: {
1235
+ auto *x = reinterpret_cast <TEvHive::TEvResponseHiveInfo::TPtr*>(&ev);
1236
+ AddBadServerlessTablet (x);
1237
+ break ;
1238
+ }
1239
+ case TEvSchemeShard::EvDescribeSchemeResult: {
1240
+ auto *x = reinterpret_cast <NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr*>(&ev);
1241
+ ChangeDescribeSchemeResultServerless (x);
1242
+ break ;
1243
+ }
1244
+ case TEvBlobStorage::EvControllerConfigResponse: {
1245
+ auto *x = reinterpret_cast <TEvBlobStorage::TEvControllerConfigResponse::TPtr*>(&ev);
1246
+ AddGroupVSlotInControllerConfigResponseWithStaticGroup (x, NKikimrBlobStorage::TGroupStatus::FULL, TVDisks (1 ));
1247
+ break ;
1248
+ }
1249
+ case NSysView::TEvSysView::EvGetVSlotsResponse: {
1250
+ auto * x = reinterpret_cast <NSysView::TEvSysView::TEvGetVSlotsResponse::TPtr*>(&ev);
1251
+ AddVSlotsToSysViewResponse (x, 1 , TVDisks (1 ));
1252
+ break ;
1253
+ }
1254
+ case NSysView::TEvSysView::EvGetGroupsResponse: {
1255
+ auto * x = reinterpret_cast <NSysView::TEvSysView::TEvGetGroupsResponse::TPtr*>(&ev);
1256
+ AddGroupsToSysViewResponse (x);
1257
+ break ;
1258
+ }
1259
+ case NSysView::TEvSysView::EvGetStoragePoolsResponse: {
1260
+ auto * x = reinterpret_cast <NSysView::TEvSysView::TEvGetStoragePoolsResponse::TPtr*>(&ev);
1261
+ AddStoragePoolsToSysViewResponse (x);
1262
+ break ;
1263
+ }
1264
+ }
1265
+
1266
+ return TTestActorRuntime::EEventAction::PROCESS;
1267
+ };
1268
+ runtime.SetObserverFunc (observerFunc);
1269
+
1270
+ TActorId sender = runtime.AllocateEdgeActor ();
1271
+ TAutoPtr<IEventHandle> handle;
1272
+
1273
+ auto *request = new NHealthCheck::TEvSelfCheckRequest;
1274
+ request->Request .set_return_verbose_status (true );
1275
+ runtime.Send (new IEventHandle (NHealthCheck::MakeHealthCheckID (), sender, request, 0 ));
1276
+ const auto result = runtime.GrabEdgeEvent <NHealthCheck::TEvSelfCheckResult>(handle)->Result ;
1277
+ Ctest << result.ShortDebugString ();
1278
+ UNIT_ASSERT (HasTabletIssue (result));
1279
+ }
1280
+
1167
1281
Y_UNIT_TEST (DontIgnoreServerlessWithExclusiveNodesWhenNotSpecific) {
1168
1282
TPortManager tp;
1169
1283
ui16 port = tp.GetPort (2134 );
@@ -1859,15 +1973,6 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
1859
1973
ShardsQuotaTest (105 , 0 , 0 , Ydb::Monitoring::StatusFlag::GREEN);
1860
1974
}
1861
1975
1862
- bool HasDeadTabletIssue (const Ydb::Monitoring::SelfCheckResult& result) {
1863
- for (const auto & issue_log : result.issue_log ()) {
1864
- if (issue_log.level () == 4 && issue_log.type () == " TABLET" ) {
1865
- return true ;
1866
- }
1867
- }
1868
- return false ;
1869
- }
1870
-
1871
1976
Y_UNIT_TEST (TestTabletIsDead) {
1872
1977
TPortManager tp;
1873
1978
ui16 port = tp.GetPort (2134 );
@@ -1895,7 +2000,7 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
1895
2000
auto result = runtime->GrabEdgeEvent <NHealthCheck::TEvSelfCheckResult>(handle)->Result ;
1896
2001
Cerr << result.ShortDebugString ();
1897
2002
1898
- UNIT_ASSERT (HasDeadTabletIssue (result));
2003
+ UNIT_ASSERT (HasTabletIssue (result));
1899
2004
}
1900
2005
1901
2006
Y_UNIT_TEST (TestBootingTabletIsNotDead) {
@@ -1926,7 +2031,7 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
1926
2031
auto result = runtime->GrabEdgeEvent <NHealthCheck::TEvSelfCheckResult>(handle)->Result ;
1927
2032
Cerr << result.ShortDebugString ();
1928
2033
1929
- UNIT_ASSERT (!HasDeadTabletIssue (result));
2034
+ UNIT_ASSERT (!HasTabletIssue (result));
1930
2035
}
1931
2036
1932
2037
Y_UNIT_TEST (TestReBootingTabletIsDead) {
@@ -1960,7 +2065,7 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
1960
2065
auto result = runtime->GrabEdgeEvent <NHealthCheck::TEvSelfCheckResult>(handle)->Result ;
1961
2066
Cerr << result.ShortDebugString ();
1962
2067
1963
- UNIT_ASSERT (HasDeadTabletIssue (result));
2068
+ UNIT_ASSERT (HasTabletIssue (result));
1964
2069
}
1965
2070
1966
2071
void SendHealthCheckConfigUpdate (TTestActorRuntime &runtime, const TActorId& sender, const NKikimrConfig::THealthCheckConfig &cfg) {
0 commit comments