diff options
| author | robot-piglet <[email protected]> | 2024-10-26 23:07:55 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2024-10-26 23:26:45 +0300 |
| commit | ddabd4ddff87ac13bfc87ef02af352216a0f4e13 (patch) | |
| tree | 4755244bec60b9b49493d4bcecaa05875e8dd19b | |
| parent | 939beab49e2c694a55e8fbab276cbd9a01aa412e (diff) | |
Intermediate changes
commit_hash:964d9566fa664020a6ff9c0b33d9fa404b6b1f1b
| -rw-r--r-- | yt/yt/core/concurrency/unittests/async_looper_ut.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/yt/yt/core/concurrency/unittests/async_looper_ut.cpp b/yt/yt/core/concurrency/unittests/async_looper_ut.cpp index a05ed39b429..018bfa5e477 100644 --- a/yt/yt/core/concurrency/unittests/async_looper_ut.cpp +++ b/yt/yt/core/concurrency/unittests/async_looper_ut.cpp @@ -111,12 +111,14 @@ TEST(TAsyncLooperTest, CancelAsyncStep) NThreading::TEvent started; auto promise = NewPromise<void>(); + bool callbackFinished = false; - auto asyncStart = BIND([invoker = queue->GetInvoker(), promise, &started] (bool) { - return BIND([promise, &started] { + auto asyncStart = BIND([invoker = queue->GetInvoker(), promise, &started, &callbackFinished] (bool) { + return BIND([promise, &started, &callbackFinished] { started.NotifyAll(); WaitFor(promise.ToFuture()) .ThrowOnError(); + callbackFinished = true; }).AsyncVia(invoker).Run(); }); @@ -136,7 +138,11 @@ TEST(TAsyncLooperTest, CancelAsyncStep) queue->Shutdown(); - EXPECT_TRUE(promise.IsCanceled()); + // Cancelation is a bit racy and sometimes promise is set with error + // instead of being canceled "for real". Thus we simply check that + // the code didn't go through completely. + // EXPECT_TRUE(promise.IsCanceled()); + EXPECT_FALSE(callbackFinished); } TEST(TAsyncLooperTest, CancelSyncStep) |
