@@ -2416,5 +2416,51 @@ Y_UNIT_TEST_SUITE(THealthCheckTest) {
24162416 }
24172417 UNIT_ASSERT (!pdiskIssueFoundInResult);
24182418 }
2419+
2420+ Y_UNIT_TEST (TestSystemStateRetriesAfterReceivingResponse) {
2421+ TPortManager tp;
2422+ ui16 port = tp.GetPort (2134 );
2423+ ui16 grpcPort = tp.GetPort (2135 );
2424+ auto settings = TServerSettings (port)
2425+ .SetNodeCount (1 )
2426+ .SetDynamicNodeCount (1 )
2427+ .SetUseRealThreads (false )
2428+ .SetDomainName (" Root" );
2429+ TServer server (settings);
2430+ server.EnableGRpc (grpcPort);
2431+ TClient client (settings);
2432+ TTestActorRuntime& runtime = *server.GetRuntime ();
2433+
2434+ TActorId sender = runtime.AllocateEdgeActor ();
2435+ TAutoPtr<IEventHandle> handle;
2436+
2437+ std::optional<TActorId> targetActor;
2438+ auto observerFunc = [&](TAutoPtr<IEventHandle>& ev) {
2439+ switch (ev->GetTypeRewrite ()) {
2440+ case TEvWhiteboard::EvSystemStateResponse: {
2441+ if (ev->Cookie == 1 ) {
2442+ if (!targetActor) {
2443+ targetActor = ev->Recipient ;
2444+ runtime.Send (ev.Release ());
2445+ runtime.Send (new IEventHandle (
2446+ *targetActor,
2447+ sender,
2448+ new NHealthCheck::TEvPrivate::TEvRetryNodeWhiteboard (1 , TEvWhiteboard::TEvSystemStateRequest::EventType)
2449+ ));
2450+
2451+ }
2452+ return TTestActorRuntime::EEventAction::DROP;
2453+ }
2454+ break ;
2455+ }
2456+ }
2457+ return TTestActorRuntime::EEventAction::PROCESS;
2458+ };
2459+ runtime.SetObserverFunc (observerFunc);
2460+ runtime.Send (new IEventHandle (NHealthCheck::MakeHealthCheckID (), sender, new NHealthCheck::TEvSelfCheckRequest (), 0 ));
2461+
2462+ auto result = runtime.GrabEdgeEvent <NHealthCheck::TEvSelfCheckResult>(handle)->Result ;
2463+ UNIT_ASSERT_VALUES_EQUAL (result.self_check_result (), Ydb::Monitoring::SelfCheck::GOOD);
2464+ }
24192465}
24202466}
0 commit comments