aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Borzenkov <snaury@gmail.com>2022-04-20 22:48:06 +0300
committerAlexey Borzenkov <snaury@gmail.com>2022-04-20 22:48:06 +0300
commitaeb42d9215cd131948447bbef79b6afdcba6399c (patch)
tree929fb8983550cccdb6340c1d09f9da6852e0ba41
parentba304a03055fcc4a53824cea3ccb73397c48b87e (diff)
downloadydb-aeb42d9215cd131948447bbef79b6afdcba6399c.tar.gz
Add SimulateSleep method to test runtime, KIKIMR-14760
ref:dbf5108bef6c29631ded3fd8365bc670d7e19eee
-rw-r--r--ydb/core/testlib/actors/test_runtime.cpp8
-rw-r--r--ydb/core/testlib/actors/test_runtime.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/ydb/core/testlib/actors/test_runtime.cpp b/ydb/core/testlib/actors/test_runtime.cpp
index ff09f2df275..5c542ae28d8 100644
--- a/ydb/core/testlib/actors/test_runtime.cpp
+++ b/ydb/core/testlib/actors/test_runtime.cpp
@@ -213,6 +213,14 @@ namespace NActors {
return true;
}
+ void TTestActorRuntime::SimulateSleep(TDuration duration) {
+ if (!SleepEdgeActor) {
+ SleepEdgeActor = AllocateEdgeActor();
+ }
+ Schedule(new IEventHandle(SleepEdgeActor, SleepEdgeActor, new TEvents::TEvWakeup()), duration);
+ GrabEdgeEventRethrow<TEvents::TEvWakeup>(SleepEdgeActor);
+ }
+
void TTestActorRuntime::SendToPipe(ui64 tabletId, const TActorId& sender, IEventBase* payload, ui32 nodeIndex, const NKikimr::NTabletPipe::TClientConfig& pipeConfig, TActorId clientId, ui64 cookie) {
bool newPipe = (clientId == TActorId());
if (newPipe) {
diff --git a/ydb/core/testlib/actors/test_runtime.h b/ydb/core/testlib/actors/test_runtime.h
index 869304c51b3..2185c8d98b3 100644
--- a/ydb/core/testlib/actors/test_runtime.h
+++ b/ydb/core/testlib/actors/test_runtime.h
@@ -56,6 +56,8 @@ namespace NActors {
ui16 GetMonPort(ui32 nodeIndex = 0) const;
+ void SimulateSleep(TDuration duration);
+
void SendToPipe(ui64 tabletId, const TActorId& sender, IEventBase* payload, ui32 nodeIndex = 0,
const NKikimr::NTabletPipe::TClientConfig& pipeConfig = NKikimr::NTabletPipe::TClientConfig(), TActorId clientId = TActorId(), ui64 cookie = 0);
void SendToPipe(TActorId clientId, const TActorId& sender, IEventBase* payload,
@@ -89,5 +91,6 @@ namespace NActors {
TKeyConfigGenerator KeyConfigGenerator;
THolder<IDestructable> Opaque;
TVector<ui16> MonPorts;
+ TActorId SleepEdgeActor;
};
} // namespace NActors