summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/txns/kill_cursors_in_transaction.js18
1 files changed, 6 insertions, 12 deletions
diff --git a/jstests/core/txns/kill_cursors_in_transaction.js b/jstests/core/txns/kill_cursors_in_transaction.js
index aa68cb25f73..2ca718a7e33 100644
--- a/jstests/core/txns/kill_cursors_in_transaction.js
+++ b/jstests/core/txns/kill_cursors_in_transaction.js
@@ -25,22 +25,16 @@
assert.commandWorked(sessionDb.runCommand({killCursors: collName, cursors: [res.cursor.id]}));
session.commitTransaction();
- jsTest.log("Test that the killCursors can be the first operation in a transaction.");
- // Note that it is not a requirement to support this behavior. This test is present to ensure
- // that the server does not crash or return an unhelpful error message.
-
+ jsTest.log("Test that the killCursors cannot be the first operation in a transaction.");
res = assert.commandWorked(sessionDb.runCommand({find: collName, batchSize: 2}));
assert(res.hasOwnProperty("cursor"), tojson(res));
assert(res.cursor.hasOwnProperty("id"), tojson(res));
session.startTransaction();
- assert.commandWorked(sessionDb.runCommand({killCursors: collName, cursors: [res.cursor.id]}));
-
- try {
- session.commitTransaction();
- } catch (ex) {
- assert.eq(50940, ex.code);
- print('Error (expected) returned while performing commit: ' + tojson(ex));
- }
+ assert.commandFailedWithCode(
+ sessionDb.runCommand({killCursors: collName, cursors: [res.cursor.id]}),
+ ErrorCodes.OperationNotSupportedInTransaction);
+ assert.commandFailedWithCode(session.abortTransaction_forTesting(),
+ ErrorCodes.NoSuchTransaction);
jsTest.log("killCursors must not block on locks held by the transaction in which it is run.");