summaryrefslogtreecommitdiff
path: root/src/mongo/db/op_observer_impl_test.cpp
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2018-07-03 14:45:31 -0400
committerJudah Schvimer <judah@mongodb.com>2018-07-03 14:45:31 -0400
commitcc39290b6580d638da957506ca8660ef0d015d91 (patch)
treefcc6987c1cd4f5dd20a9e060cf67538350ef0c1f /src/mongo/db/op_observer_impl_test.cpp
parent57d7938c49da06122d4d43054ff89e1881d0209f (diff)
downloadmongo-cc39290b6580d638da957506ca8660ef0d015d91.tar.gz
SERVER-35729 Create explicit Session state transition table
Diffstat (limited to 'src/mongo/db/op_observer_impl_test.cpp')
-rw-r--r--src/mongo/db/op_observer_impl_test.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/op_observer_impl_test.cpp b/src/mongo/db/op_observer_impl_test.cpp
index fab5673d240..3fb735d1c38 100644
--- a/src/mongo/db/op_observer_impl_test.cpp
+++ b/src/mongo/db/op_observer_impl_test.cpp
@@ -431,6 +431,7 @@ TEST_F(OpObserverLargeTransactionTest, TransactionTooLargeWhileCommitting) {
<< BSONBinData(halfTransactionData.get(), kHalfTransactionSize, BinDataGeneral)));
session->addTransactionOperation(opCtx.get(), operation);
session->addTransactionOperation(opCtx.get(), operation);
+ session->transitionToCommittingforTest();
ASSERT_THROWS_CODE(opObserver.onTransactionCommit(opCtx.get()),
AssertionException,
ErrorCodes::TransactionTooLarge);
@@ -591,6 +592,7 @@ TEST_F(OpObserverTransactionTest, TransactionalPrepareTest) {
<< "x"));
opObserver().onDelete(opCtx(), nss1, uuid1, 0, false, boost::none);
+ session()->transitionToPreparedforTest();
opObserver().onTransactionPrepare(opCtx());
auto oplogEntryObj = getSingleOplogEntry(opCtx());
@@ -651,6 +653,7 @@ TEST_F(OpObserverTransactionTest, PreparingEmptyTransactionLogsEmptyApplyOps) {
"prepareTransaction");
session()->unstashTransactionResources(opCtx(), "prepareTransaction");
+ session()->transitionToPreparedforTest();
opObserver().onTransactionPrepare(opCtx());
auto oplogEntryObj = getSingleOplogEntry(opCtx());
@@ -699,6 +702,7 @@ TEST_F(OpObserverTransactionTest, TransactionalInsertTest) {
AutoGetCollection autoColl2(opCtx(), nss2, MODE_IX);
opObserver().onInserts(opCtx(), nss1, uuid1, inserts1.begin(), inserts1.end(), false);
opObserver().onInserts(opCtx(), nss2, uuid2, inserts2.begin(), inserts2.end(), false);
+ session()->transitionToCommittingforTest();
opObserver().onTransactionCommit(opCtx());
auto oplogEntryObj = getSingleOplogEntry(opCtx());
checkCommonFields(oplogEntryObj);
@@ -786,6 +790,7 @@ TEST_F(OpObserverTransactionTest, TransactionalUpdateTest) {
AutoGetCollection autoColl2(opCtx(), nss2, MODE_IX);
opObserver().onUpdate(opCtx(), update1);
opObserver().onUpdate(opCtx(), update2);
+ session()->transitionToCommittingforTest();
opObserver().onTransactionCommit(opCtx());
auto oplogEntry = getSingleOplogEntry(opCtx());
checkCommonFields(oplogEntry);
@@ -846,6 +851,7 @@ TEST_F(OpObserverTransactionTest, TransactionalDeleteTest) {
BSON("_id" << 1 << "data"
<< "y"));
opObserver().onDelete(opCtx(), nss2, uuid2, 0, false, boost::none);
+ session()->transitionToCommittingforTest();
opObserver().onTransactionCommit(opCtx());
auto oplogEntry = getSingleOplogEntry(opCtx());
checkCommonFields(oplogEntry);