diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-02-12 16:56:00 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-02-22 07:19:19 -0500 |
commit | 63220b7df242b26f83c7083394b463c4e4b3a5d8 (patch) | |
tree | 203129f84d8afad520169a95fd03138af7b4107b /src/mongo/db/s/transaction_coordinator_futures_util_test.cpp | |
parent | cdc5a7e8fe27e66b4a5f862cf9624130fd5e4eeb (diff) | |
download | mongo-63220b7df242b26f83c7083394b463c4e4b3a5d8.tar.gz |
SERVER-38522/SERVER-38715 Make all TransactionCoordinator tasks interruptible
Diffstat (limited to 'src/mongo/db/s/transaction_coordinator_futures_util_test.cpp')
-rw-r--r-- | src/mongo/db/s/transaction_coordinator_futures_util_test.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp b/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp index cf7a2f75e5a..4948c57d260 100644 --- a/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp +++ b/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp @@ -597,6 +597,27 @@ TEST_F(AsyncWorkSchedulerTest, MakeChildSchedulerAfterShutdownParentScheduler) { ASSERT_THROWS_CODE(childFuture2.get(), AssertionException, ErrorCodes::InternalError); } +TEST_F(AsyncWorkSchedulerTest, ShutdownAllowedFromScheduleWorkAtCallback) { + AsyncWorkScheduler async(getServiceContext()); + auto future = async.scheduleWork([&](OperationContext* opCtx) { + async.shutdown({ErrorCodes::InternalError, "Test error"}); + }); + + future.get(); +} + +TEST_F(AsyncWorkSchedulerTest, DestroyingSchedulerCapturedInFutureCallback) { + auto async = std::make_unique<AsyncWorkScheduler>(getServiceContext()); + + Barrier barrier(2); + auto future = + async->scheduleWork([&barrier](OperationContext* opCtx) { barrier.countDownAndWait(); }) + .tapAll([ async = std::move(async), &barrier ](Status){}); + + barrier.countDownAndWait(); + future.get(); +} + using DoWhileTest = AsyncWorkSchedulerTest; |