Skip to content

Commit

Permalink
WIP TESTS
Browse files Browse the repository at this point in the history
  • Loading branch information
komarevtsev-d committed Nov 21, 2024
1 parent 2cbf061 commit 852563f
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 20 deletions.
1 change: 1 addition & 0 deletions cloud/blockstore/libs/storage/volume/ut/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ INCLUDE(${ARCADIA_ROOT}/cloud/storage/core/tests/recipes/medium.inc)

SRCS(
volume_database_ut.cpp
volume_lagging_agent_ut.cpp
volume_state_ut.cpp
volume_ut.cpp
volume_ut_checkpoint.cpp
Expand Down
34 changes: 34 additions & 0 deletions cloud/blockstore/libs/storage/volume/volume_lagging_agent_ut.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <cloud/blockstore/libs/storage/volume/testlib/test_env.h>
#include <cloud/blockstore/libs/storage/api/volume_proxy.h>
#include <cloud/blockstore/libs/storage/partition_common/events_private.h>
#include <cloud/blockstore/libs/storage/partition_nonrepl/model/processing_blocks.h>
#include <cloud/blockstore/libs/storage/stats_service/stats_service_events_private.h>

#include <util/system/hostname.h>

namespace NCloud::NBlockStore::NStorage {

using namespace NActors;

using namespace NKikimr;

using namespace NCloud::NBlockStore::NStorage::NPartition;

using namespace NCloud::NStorage;

using namespace NTestVolume;


////////////////////////////////////////////////////////////////////////////////

Y_UNIT_TEST_SUITE(TLaggingAgentVolumeTest) {
Y_UNIT_TEST(ShouldUpdateVolumeConfig)
{
auto runtime = PrepareTestActorRuntime();

TVolumeClient volume(*runtime);
volume.UpdateVolumeConfig();
}
}

} // namespace NCloud::NBlockStore::NStorage
22 changes: 22 additions & 0 deletions cloud/blockstore/libs/storage/volume/volume_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,28 @@ TRuntimeVolumeParams& TVolumeState::GetVolumeParams()
return VolumeParams;
}

void TVolumeState::AddLaggingAgent(NProto::TLaggingAgent agent)
{
Meta.MutableLaggingAgentsInfo()->MutableAgents()->Add(std::move(agent));
}

void TVolumeState::RemoveLaggingAgent(const TString& agentId)
{
const auto& laggingAgents = Meta.GetLaggingAgentsInfo().GetAgents();
auto it = FindIf(
laggingAgents,
[&agentId](const auto& agent)
{ return agent.GetAgentId() == agentId; });
if (it != laggingAgents.end()) {
Meta.MutableLaggingAgentsInfo()->MutableAgents()->erase(it);
}
}

void TVolumeState::SetNeedToSyncFreshDevicesWithDR(bool value)
{
Meta.MutableLaggingAgentsInfo()->SetNeedToSyncFreshDevicesWithDR(value);
}

void TVolumeState::ResetMeta(NProto::TVolumeMeta meta)
{
Meta = std::move(meta);
Expand Down
23 changes: 3 additions & 20 deletions cloud/blockstore/libs/storage/volume/volume_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,26 +305,9 @@ class TVolumeState
Meta.SetFillSeqNumber(fillSeqNumber);
}

void AddLaggingAgent(NProto::TLaggingAgent agent)
{
Meta.MutableLaggingAgentsInfo()->MutableAgents()->Add(std::move(agent));
}

void RemoveLaggingAgent(const TString& agentId)
{
const auto& laggingAgents = Meta.GetLaggingAgentsInfo().GetAgents();
auto it = FindIf(
laggingAgents,
[&agentId](const auto& agent)
{ return agent.GetAgentId() == agentId; });
if (it != laggingAgents.end()) {
Meta.MutableLaggingAgentsInfo()->MutableAgents()->erase(it);
}
}

void SetNeedToSyncFreshDevicesWithDR(bool value) {
Meta.MutableLaggingAgentsInfo()->SetNeedToSyncFreshDevicesWithDR(value);
}
void AddLaggingAgent(NProto::TLaggingAgent agent);
void RemoveLaggingAgent(const TString& agentId);
void SetNeedToSyncFreshDevicesWithDR(bool value);

void SetStartPartitionsNeeded(bool startPartitionsNeeded)
{
Expand Down

0 comments on commit 852563f

Please sign in to comment.