diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:20:35 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-27 11:02:23 -0400 |
commit | 134a4083953270e8a11430395357fb70a29047ad (patch) | |
tree | dd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js')
-rw-r--r-- | jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js b/jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js index 2aa272a0d2b..ce41fb98620 100644 --- a/jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js +++ b/jstests/core/txns/no_new_transactions_when_prepared_transaction_in_progress.js @@ -5,51 +5,52 @@ */ (function() { - "use strict"; - load("jstests/core/txns/libs/prepare_helpers.js"); - - const dbName = "test"; - const collName = "no_new_transactions_when_prepared_transaction_in_progress"; - const testDB = db.getSiblingDB(dbName); - - testDB.runCommand({drop: collName, writeConcern: {w: "majority"}}); - - assert.commandWorked(testDB.runCommand({create: collName, writeConcern: {w: "majority"}})); - - const sessionOptions = {causalConsistency: false}; - const session = testDB.getMongo().startSession(sessionOptions); - const sessionDb = session.getDatabase(dbName); - const sessionColl = sessionDb.getCollection(collName); - - jsTestLog( - "Test starting a new transaction while an existing prepared transaction exists on the " + - "session."); - session.startTransaction(); - assert.commandWorked(sessionColl.insert({_id: "insert-1"})); - PrepareHelpers.prepareTransaction(session); - assert.commandFailedWithCode(sessionDb.runCommand({ - insert: collName, - documents: [{_id: "cannot_start"}], - readConcern: {level: "snapshot"}, - txnNumber: NumberLong(1), - stmtId: NumberInt(0), - startTransaction: true, - autocommit: false - }), - ErrorCodes.PreparedTransactionInProgress); - - jsTestLog( - "Test error precedence when executing a malformed command during a prepared transaction."); - // The following command specifies txnNumber: 2 without startTransaction: true. - assert.commandFailedWithCode(sessionDb.runCommand({ - insert: collName, - documents: [{_id: "no_such_txn"}], - txnNumber: NumberLong(2), - stmtId: NumberInt(0), - autocommit: false - }), - ErrorCodes.NoSuchTransaction); - assert.commandWorked(session.abortTransaction_forTesting()); - - session.endSession(); +"use strict"; +load("jstests/core/txns/libs/prepare_helpers.js"); + +const dbName = "test"; +const collName = "no_new_transactions_when_prepared_transaction_in_progress"; +const testDB = db.getSiblingDB(dbName); + +testDB.runCommand({drop: collName, writeConcern: {w: "majority"}}); + +assert.commandWorked(testDB.runCommand({create: collName, writeConcern: {w: "majority"}})); + +const sessionOptions = { + causalConsistency: false +}; +const session = testDB.getMongo().startSession(sessionOptions); +const sessionDb = session.getDatabase(dbName); +const sessionColl = sessionDb.getCollection(collName); + +jsTestLog("Test starting a new transaction while an existing prepared transaction exists on the " + + "session."); +session.startTransaction(); +assert.commandWorked(sessionColl.insert({_id: "insert-1"})); +PrepareHelpers.prepareTransaction(session); +assert.commandFailedWithCode(sessionDb.runCommand({ + insert: collName, + documents: [{_id: "cannot_start"}], + readConcern: {level: "snapshot"}, + txnNumber: NumberLong(1), + stmtId: NumberInt(0), + startTransaction: true, + autocommit: false +}), + ErrorCodes.PreparedTransactionInProgress); + +jsTestLog( + "Test error precedence when executing a malformed command during a prepared transaction."); +// The following command specifies txnNumber: 2 without startTransaction: true. +assert.commandFailedWithCode(sessionDb.runCommand({ + insert: collName, + documents: [{_id: "no_such_txn"}], + txnNumber: NumberLong(2), + stmtId: NumberInt(0), + autocommit: false +}), + ErrorCodes.NoSuchTransaction); +assert.commandWorked(session.abortTransaction_forTesting()); + +session.endSession(); }()); |