diff options
author | mokhotskii <mokhotskii@ydb.tech> | 2022-08-15 13:14:56 +0300 |
---|---|---|
committer | mokhotskii <mokhotskii@ydb.tech> | 2022-08-15 13:14:56 +0300 |
commit | c904524b8083afaa45f6b37a85b299227c1c097d (patch) | |
tree | 25e0fa26ccfcb514cdd5b4dcf35e51d39c16dc8e | |
parent | d1cd2a0b2e3dbe2a42d87f5a5f54ffc8cae3130d (diff) | |
download | ydb-c904524b8083afaa45f6b37a85b299227c1c097d.tar.gz |
Introduce SetupSysViewService to testlib
Introduce SetupSysViewService to testlib
Add AppData.FeatureFlags.EnableDbCounters flag set/get functions.
Both are needed to test SysView-related functionality in core
components.
-rw-r--r-- | ydb/core/testlib/basics/appdata.cpp | 5 | ||||
-rw-r--r-- | ydb/core/testlib/basics/appdata.h | 1 | ||||
-rw-r--r-- | ydb/core/testlib/basics/services.cpp | 22 |
3 files changed, 25 insertions, 3 deletions
diff --git a/ydb/core/testlib/basics/appdata.cpp b/ydb/core/testlib/basics/appdata.cpp index 069ba8e7071..1786eaeceb6 100644 --- a/ydb/core/testlib/basics/appdata.cpp +++ b/ydb/core/testlib/basics/appdata.cpp @@ -193,4 +193,9 @@ namespace NKikimr { } } + void TAppPrepare::SetEnableDbCounters(bool value) + { + FeatureFlags.SetEnableDbCounters(value); + } + } diff --git a/ydb/core/testlib/basics/appdata.h b/ydb/core/testlib/basics/appdata.h index 865cf3e8529..cdf1cf9bd0f 100644 --- a/ydb/core/testlib/basics/appdata.h +++ b/ydb/core/testlib/basics/appdata.h @@ -79,6 +79,7 @@ namespace NKikimr { void AddSystemBackupSID(const TString& sid); void SetEnableProtoSourceIdInfo(std::optional<bool> value); void SetEnablePqBilling(std::optional<bool> value); + void SetEnableDbCounters(bool value); TIntrusivePtr<TChannelProfiles> Channels; NKikimrBlobStorage::TNodeWardenServiceSet BSConf; diff --git a/ydb/core/testlib/basics/services.cpp b/ydb/core/testlib/basics/services.cpp index d6589d6b66e..9ffba79e191 100644 --- a/ydb/core/testlib/basics/services.cpp +++ b/ydb/core/testlib/basics/services.cpp @@ -27,6 +27,7 @@ #include <ydb/core/tx/schemeshard/schemeshard.h> #include <ydb/core/tx/scheme_board/cache.h> #include <ydb/core/tx/columnshard/blob_cache.h> +#include <ydb/core/sys_view/service/sysview_service.h> #include <util/system/env.h> @@ -301,6 +302,13 @@ namespace NPDisk { nodeIndex); } + void SetupSysViewService(TTestActorRuntime& runtime, ui32 nodeIndex) + { + runtime.AddLocalService(NSysView::MakeSysViewServiceID(runtime.GetNodeId(nodeIndex)), + TActorSetupCmd(NSysView::CreateSysViewServiceForTests().Release(), TMailboxType::Revolving, 0), + nodeIndex); + } + void SetupBasicServices(TTestActorRuntime& runtime, TAppPrepare& app, bool mock, NFake::INode* factory, NFake::TStorage storage, NFake::TCaches caches) { @@ -332,6 +340,7 @@ namespace NPDisk { SetupResourceBroker(runtime, nodeIndex); SetupSharedPageCache(runtime, nodeIndex, caches); SetupBlobCache(runtime, nodeIndex); + SetupSysViewService(runtime, nodeIndex); SetupQuoterService(runtime, nodeIndex); if (factory) @@ -342,13 +351,20 @@ namespace NPDisk { for (ui32 nodeIndex = 0; nodeIndex < runtime.GetNodeCount(); ++nodeIndex) { // NodeWarden (and its actors) relies on timers to work correctly - auto actorId = runtime.GetLocalServiceId( + auto blobStorageActorId = runtime.GetLocalServiceId( MakeBlobStorageNodeWardenID(runtime.GetNodeId(nodeIndex)), nodeIndex); - Y_VERIFY(actorId, "Missing node warden on node %" PRIu32, nodeIndex); - runtime.EnableScheduleForActor(actorId); + Y_VERIFY(blobStorageActorId, "Missing node warden on node %" PRIu32, nodeIndex); + runtime.EnableScheduleForActor(blobStorageActorId); + + // SysView Service uses Scheduler to send counters + auto sysViewServiceId = runtime.GetLocalServiceId( + NSysView::MakeSysViewServiceID(runtime.GetNodeId(nodeIndex)), nodeIndex); + Y_VERIFY(sysViewServiceId, "Missing SysView Service on node %" PRIu32, nodeIndex); + runtime.EnableScheduleForActor(sysViewServiceId); } + if (!mock && !runtime.IsRealThreads()) { ui32 evNum = disk.DomainsNum * disk.DisksInDomain; TDispatchOptions options; |