diff options
Diffstat (limited to 'jstests/core/txns')
| -rw-r--r-- | jstests/core/txns/abort_expired_transaction.js | 13 | ||||
| -rw-r--r-- | jstests/core/txns/aggregation_in_transaction.js | 2 | ||||
| -rw-r--r-- | jstests/core/txns/prepare_conflict_aggregation_behavior.js | 7 |
3 files changed, 20 insertions, 2 deletions
diff --git a/jstests/core/txns/abort_expired_transaction.js b/jstests/core/txns/abort_expired_transaction.js index b211ef7b132..54418596967 100644 --- a/jstests/core/txns/abort_expired_transaction.js +++ b/jstests/core/txns/abort_expired_transaction.js @@ -33,6 +33,11 @@ try { const session = db.getMongo().startSession(sessionOptions); const sessionDb = session.getDatabase(testDBName); + // Number of passes made by the "abortExpiredTransactions" thread before the transaction + // expires. + const abortExpiredTransactionsPassesPreAbort = + db.serverStatus().metrics.abortExpiredTransactions.passes; + let txnNumber = 0; jsTest.log("Insert a document starting a transaction."); @@ -64,6 +69,14 @@ try { "currentOp reports that the idle transaction still exists, it has not been " + "aborted as expected."); + assert.soon(() => { + // For this expired transaction to abort, the "abortExpiredTransactions" thread has to + // perform at least one pass. + const serverStatus = db.serverStatus(); + return abortExpiredTransactionsPassesPreAbort < + serverStatus.metrics.abortExpiredTransactions.passes; + }); + jsTest.log( "Attempt to do a write in the transaction, which should fail because the transaction " + "was aborted"); diff --git a/jstests/core/txns/aggregation_in_transaction.js b/jstests/core/txns/aggregation_in_transaction.js index ec1c62133bb..40d7030fe1f 100644 --- a/jstests/core/txns/aggregation_in_transaction.js +++ b/jstests/core/txns/aggregation_in_transaction.js @@ -1,5 +1,5 @@ // Tests that aggregation is supported in transactions. -// @tags: [uses_transactions, uses_snapshot_read_concern] +// @tags: [uses_transactions, uses_snapshot_read_concern, references_foreign_collection] (function() { "use strict"; diff --git a/jstests/core/txns/prepare_conflict_aggregation_behavior.js b/jstests/core/txns/prepare_conflict_aggregation_behavior.js index c62b7370dc6..c07f96e2b54 100644 --- a/jstests/core/txns/prepare_conflict_aggregation_behavior.js +++ b/jstests/core/txns/prepare_conflict_aggregation_behavior.js @@ -3,7 +3,12 @@ * should not block on prepare conflicts, but writing out to a collection as a part of an aggregate * pipeline should block on prepare conflicts. * - * @tags: [uses_transactions, uses_prepare_transaction] + * The test runs commands that are not allowed with security token: endSession, prepareTransaction. + * @tags: [ + * references_foreign_collection, + * uses_transactions, + * uses_prepare_transaction, + * ] */ (function() { "use strict"; |
