diff options
Diffstat (limited to 'jstests/sharding/libs/update_shard_key_helpers.js')
-rw-r--r-- | jstests/sharding/libs/update_shard_key_helpers.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/jstests/sharding/libs/update_shard_key_helpers.js b/jstests/sharding/libs/update_shard_key_helpers.js index f7c52067200..2260372bc6f 100644 --- a/jstests/sharding/libs/update_shard_key_helpers.js +++ b/jstests/sharding/libs/update_shard_key_helpers.js @@ -164,7 +164,8 @@ function runUpdateCmdFail(st, if (errorCode) { assert.commandFailedWithCode(res, errorCode); } - session.abortTransaction_forTesting(); + assert.commandFailedWithCode(session.abortTransaction_forTesting(), + ErrorCodes.NoSuchTransaction); } else { res = sessionDB.foo.update(query, update, {multi: multiParamSet}); assert.writeError(res); @@ -189,7 +190,8 @@ function runFindAndModifyCmdFail( assert.throws(function() { sessionDB.foo.findAndModify({query: query, update: update, "upsert": upsert}); }); - session.abortTransaction_forTesting(); + assert.commandFailedWithCode(session.abortTransaction_forTesting(), + ErrorCodes.NoSuchTransaction); } else { assert.throws(function() { sessionDB.foo.findAndModify({query: query, update: update, "upsert": upsert}); @@ -705,7 +707,8 @@ function assertCannotUpdateInBulkOpWhenDocsMoveShards( bulkOp.execute(); }); if (inTxn) { - session.abortTransaction_forTesting(); + assert.commandFailedWithCode(session.abortTransaction_forTesting(), + ErrorCodes.NoSuchTransaction); } if (!ordered && !inTxn) { @@ -755,7 +758,8 @@ function assertCannotUpdateInBulkOpWhenDocsMoveShards( bulkOp.execute(); }); if (inTxn) { - session.abortTransaction_forTesting(); + assert.commandFailedWithCode(session.abortTransaction_forTesting(), + ErrorCodes.NoSuchTransaction); } if (!inTxn) { @@ -799,7 +803,8 @@ function assertCannotUpdateInBulkOpWhenDocsMoveShards( bulkOp.execute(); }); if (inTxn) { - session.abortTransaction_forTesting(); + assert.commandFailedWithCode(session.abortTransaction_forTesting(), + ErrorCodes.NoSuchTransaction); } // The batch will fail on the first write and the second will not be attempted. @@ -833,7 +838,8 @@ function assertCannotUpdateInBulkOpWhenDocsMoveShards( bulkOp.execute(); }); if (inTxn) { - session.abortTransaction_forTesting(); + assert.commandFailedWithCode(session.abortTransaction_forTesting(), + ErrorCodes.NoSuchTransaction); } assert.eq(1, st.s.getDB(kDbName).foo.find({"x": 300}).itcount()); @@ -981,4 +987,4 @@ function assertCanUpdatePrimitiveShardKeyHashedSameShards( assertHashedShardKeyUpdateCorrect(st, kDbName, queries[1], updates[1], upsert, false); st.s.getDB(kDbName).foo.drop(); -}
\ No newline at end of file +} |