aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2023-11-11 16:45:27 +0300
committerilnaz <ilnaz@ydb.tech>2023-11-11 17:08:39 +0300
commit0c53576b2c09a1e4076a3fd197bee3f046846c94 (patch)
tree531ae1d60ed3b08c036f45d5bc39b9c5512d700e
parentcca50b7e187292196c112b36ecc0b41149afe800 (diff)
downloadydb-0c53576b2c09a1e4076a3fd197bee3f046846c94.tar.gz
Fix sentinel tests KIKIMR-18774
-rw-r--r--ydb/core/cms/cms_ut_common.cpp18
-rw-r--r--ydb/core/cms/cms_ut_common.h1
-rw-r--r--ydb/core/cms/sentinel_ut.cpp30
3 files changed, 21 insertions, 28 deletions
diff --git a/ydb/core/cms/cms_ut_common.cpp b/ydb/core/cms/cms_ut_common.cpp
index cb7dfec9b9..01be0de05e 100644
--- a/ydb/core/cms/cms_ut_common.cpp
+++ b/ydb/core/cms/cms_ut_common.cpp
@@ -511,6 +511,10 @@ static void SetupServices(TTestActorRuntime &runtime,
runtime.GetAppData().DisableCheckingSysNodesCms = true;
runtime.GetAppData().BootstrapConfig = TFakeNodeWhiteboardService::BootstrapConfig;
+ NKikimrCms::TCmsConfig cmsConfig;
+ cmsConfig.MutableSentinelConfig()->SetEnable(false);
+ runtime.GetAppData().DefaultCmsConfig = MakeHolder<NKikimrCms::TCmsConfig>(cmsConfig);
+
if (!runtime.IsRealThreads()) {
TDispatchOptions options;
options.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(TEvBlobStorage::EvLocalRecoveryDone,
@@ -533,7 +537,6 @@ static void SetupServices(TTestActorRuntime &runtime,
TCmsTestEnv::TCmsTestEnv(const TTestEnvOpts &options)
: TTestBasicRuntime(options.NodeCount, options.DataCenterCount, false)
, CmsId(MakeCmsID(0))
- , CmsTabletActor(TActorId())
{
TFakeNodeWhiteboardService::Config.MutableResponse()->SetSuccess(true);
TFakeNodeWhiteboardService::Config.MutableResponse()->ClearStatus();
@@ -545,9 +548,9 @@ TCmsTestEnv::TCmsTestEnv(const TTestEnvOpts &options)
GenerateExtendedInfo(*this, config, options.VDisks, 4, options.Tenants, options.UseMirror3dcErasure);
- SetObserverFunc([](
- TAutoPtr<IEventHandle> &event) -> auto {
+ SetObserverFunc([](TAutoPtr<IEventHandle> &event) -> auto {
if (event->GetTypeRewrite() == TEvBlobStorage::EvControllerConfigRequest
+ || event->Type == TEvBlobStorage::EvControllerConfigRequest
|| event->GetTypeRewrite() == TEvConfigsDispatcher::EvGetConfigRequest) {
auto fakeId = NNodeWhiteboard::MakeNodeWhiteboardServiceId(event->Recipient.NodeId());
if (event->Recipient != fakeId)
@@ -557,14 +560,6 @@ TCmsTestEnv::TCmsTestEnv(const TTestEnvOpts &options)
return TTestActorRuntime::EEventAction::PROCESS;
});
- SetRegistrationObserverFunc([&CmsTabletActor = CmsTabletActor](TTestActorRuntimeBase& runtime, const TActorId& parentId, const TActorId& actorId) {
- if (TypeName(*runtime.FindActor(actorId)) == "NKikimr::NCms::TCms") {
- CmsTabletActor = actorId;
- }
-
- runtime.DefaultRegistrationObserver(runtime, parentId, actorId);
- });
-
using namespace NMalloc;
TMallocInfo mallocInfo = MallocInfo();
mallocInfo.SetParam("FillMemoryOnAllocation", "false");
@@ -585,6 +580,7 @@ TCmsTestEnv::TCmsTestEnv(const TTestEnvOpts &options)
NKikimrCms::TCmsConfig cmsConfig;
cmsConfig.MutableTenantLimits()->SetDisabledNodesRatioLimit(0);
cmsConfig.MutableClusterLimits()->SetDisabledNodesRatioLimit(0);
+ cmsConfig.MutableSentinelConfig()->SetEnable(false);
SetCmsConfig(cmsConfig);
// Need to allow restart state storage nodes
diff --git a/ydb/core/cms/cms_ut_common.h b/ydb/core/cms/cms_ut_common.h
index f2ed242935..c76597a96b 100644
--- a/ydb/core/cms/cms_ut_common.h
+++ b/ydb/core/cms/cms_ut_common.h
@@ -386,7 +386,6 @@ private:
TActorId Sender;
TActorId ClientId;
- TActorId CmsTabletActor;
};
}
diff --git a/ydb/core/cms/sentinel_ut.cpp b/ydb/core/cms/sentinel_ut.cpp
index 4e16e64551..b32fbeefbe 100644
--- a/ydb/core/cms/sentinel_ut.cpp
+++ b/ydb/core/cms/sentinel_ut.cpp
@@ -366,6 +366,8 @@ Y_UNIT_TEST_SUITE(TSentinelTests) {
explicit TTestEnv(ui32 nodeCount, ui32 pdisks)
: TCmsTestEnv(nodeCount, pdisks)
{
+ SetLogPriority(NKikimrServices::CMS, NLog::PRI_DEBUG);
+
SetScheduledEventFilter([this](TTestActorRuntimeBase&, TAutoPtr<IEventHandle>& ev, TDuration, TInstant&) -> bool {
if (ev->Recipient != Sentinel) {
return true;
@@ -381,25 +383,23 @@ Y_UNIT_TEST_SUITE(TSentinelTests) {
return true;
}
});
+
auto prevObserver = SetObserverFunc(&TTestActorRuntimeBase::DefaultObserverFunc);
- SetObserverFunc([this, prevObserver](
- TAutoPtr<IEventHandle> &event){
- switch (event->GetTypeRewrite()) {
- case TEvCms::TEvClusterStateRequest::EventType:
- {
- TAutoPtr<TEvCms::TEvClusterStateResponse> resp = new TEvCms::TEvClusterStateResponse;
+ SetObserverFunc([this, prevObserver](TAutoPtr<IEventHandle>& ev) {
+ if (ev->GetTypeRewrite() == TEvCms::TEvClusterStateRequest::EventType) {
+ auto response = MakeHolder<TEvCms::TEvClusterStateResponse>();
+ auto& record = response->Record;
if (State) {
- resp->Record.MutableStatus()->SetCode(NKikimrCms::TStatus::OK);
- for (const auto &entry : State->ClusterInfo->AllNodes()) {
- NCms::TCms::AddHostState(State->ClusterInfo, *entry.second, resp->Record, State->ClusterInfo->GetTimestamp());
+ record.MutableStatus()->SetCode(NKikimrCms::TStatus::OK);
+ for (auto [_, nodeInfo]: State->ClusterInfo->AllNodes()) {
+ NCms::TCms::AddHostState(State->ClusterInfo, *nodeInfo, record, State->ClusterInfo->GetTimestamp());
}
}
- Send(new IEventHandle(event->Sender, TActorId(), resp.Release()));
- return TTestActorRuntime::EEventAction::PROCESS;
- }
- default:
- return prevObserver(event);
+ Send(ev->Sender, TActorId(), response.Release());
+ return TTestActorRuntime::EEventAction::DROP;
}
+
+ return prevObserver(ev);
});
State = new TCmsState;
@@ -409,8 +409,6 @@ Y_UNIT_TEST_SUITE(TSentinelTests) {
Sentinel = Register(CreateSentinel(State));
EnableScheduleForActor(Sentinel, true);
WaitForSentinelBoot();
-
- SetLogPriority(NKikimrServices::CMS, NLog::PRI_DEBUG);
}
TPDiskID RandomPDiskID() const {