diff options
author | Matthew Saltz <matthew.saltz@mongodb.com> | 2019-08-21 14:56:28 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-08-21 14:56:28 +0000 |
commit | 05a99879a6369d6220356d099ac5625d359ffd4d (patch) | |
tree | 8b5807e13b6acf49e7b8df0219efe112cfa99c00 /src/mongo/db/s/transaction_coordinator_test.cpp | |
parent | 54d445e84388ae82477b0094bb35cb11830056d0 (diff) | |
download | mongo-05a99879a6369d6220356d099ac5625d359ffd4d.tar.gz |
SERVER-42772 Return transaction commit decision from onCompletion future in TransactionCoordinator
Diffstat (limited to 'src/mongo/db/s/transaction_coordinator_test.cpp')
-rw-r--r-- | src/mongo/db/s/transaction_coordinator_test.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/mongo/db/s/transaction_coordinator_test.cpp b/src/mongo/db/s/transaction_coordinator_test.cpp index 828d0c2366f..f6714614b0a 100644 --- a/src/mongo/db/s/transaction_coordinator_test.cpp +++ b/src/mongo/db/s/transaction_coordinator_test.cpp @@ -956,8 +956,9 @@ TEST_F(TransactionCoordinatorTest, ASSERT_THROWS_CODE( commitDecisionFuture.get(), AssertionException, ErrorCodes::ReadConcernMajorityNotEnabled); - - coordinator.onCompletion().get(); + ASSERT_THROWS_CODE(coordinator.onCompletion().get(), + AssertionException, + ErrorCodes::ReadConcernMajorityNotEnabled); } @@ -1641,7 +1642,8 @@ TEST_F(TransactionCoordinatorMetricsTest, CoordinatorIsCanceledWhileInactive) { expectedStats.totalDuration = *expectedStats.totalDuration + Microseconds(100); coordinator.cancelIfCommitNotYetStarted(); - coordinator.onCompletion().get(); + ASSERT_THROWS_CODE( + coordinator.onCompletion().get(), DBException, ErrorCodes::NoSuchTransaction); checkStats(stats, expectedStats); checkMetrics(expectedMetrics); @@ -1683,7 +1685,8 @@ TEST_F(TransactionCoordinatorMetricsTest, CoordinatorsAWSIsShutDownWhileCoordina expectedStats.totalDuration = *expectedStats.totalDuration + Microseconds(100); awsPtr->shutdown({ErrorCodes::TransactionCoordinatorSteppingDown, "dummy"}); - coordinator.onCompletion().get(); + ASSERT_THROWS_CODE( + coordinator.onCompletion().get(), DBException, ErrorCodes::InterruptedDueToReplStateChange); checkStats(stats, expectedStats); checkMetrics(expectedMetrics); @@ -1743,7 +1746,8 @@ TEST_F(TransactionCoordinatorMetricsTest, expectedMetrics.currentWritingParticipantList--; killClientOpCtx(getServiceContext(), "hangBeforeWaitingForParticipantListWriteConcern"); - coordinator.onCompletion().get(); + ASSERT_THROWS_CODE( + coordinator.onCompletion().get(), DBException, ErrorCodes::InterruptedAtShutdown); checkStats(stats, expectedStats); checkMetrics(expectedMetrics); @@ -1806,7 +1810,9 @@ TEST_F(TransactionCoordinatorMetricsTest, network()->enterNetwork(); network()->runReadyNetworkOperations(); network()->exitNetwork(); - coordinator.onCompletion().get(); + + ASSERT_THROWS_CODE( + coordinator.onCompletion().get(), DBException, ErrorCodes::InterruptedDueToReplStateChange); checkStats(stats, expectedStats); checkMetrics(expectedMetrics); @@ -1871,7 +1877,9 @@ TEST_F(TransactionCoordinatorMetricsTest, expectedMetrics.currentWritingDecision--; killClientOpCtx(getServiceContext(), "hangBeforeWaitingForDecisionWriteConcern"); - coordinator.onCompletion().get(); + ASSERT_THROWS_CODE( + coordinator.onCompletion().get(), DBException, ErrorCodes::InterruptedAtShutdown); + checkStats(stats, expectedStats); checkMetrics(expectedMetrics); |