Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions source/crud/tests/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ The legacy format should not conflict with the newer, multi-operation format
used by other specs (e.g. Transactions). It is possible to create a unified test
runner capable of executing both formats (as some drivers do).

Error Assertions for Bulk Write Operations
==========================================

When asserting errors (e.g. ``errorContains``, ``errorCodeName``) for bulk write
operations, the test harness should inspect the ``writeConcernError`` and/or
``writeErrors`` properties of the bulk write exception. This may not be needed for
``errorContains`` if a driver concatenates all write and write concern error
messages into the bulk write exception's top-level message.

Test Runner Implementation
==========================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@
"errorLabelsOmit": [
"TransientTransactionError",
"UnknownTransactionCommitResult"
]
],
"errorContains": "E11000"
}
}
],
Expand Down
6 changes: 3 additions & 3 deletions source/transactions-convenient-api/tests/callback-retry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ tests:
result:
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
result:
# Don't assert on errorCodeName because (after SERVER-38583) the
# DuplicateKey is reported in writeErrors, not as a top-level
# command error.
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
# DuplicateKey error code included in the bulk write error message
# returned by the server
errorContains: E11000
expectations:
-
command_started_event:
Expand Down
3 changes: 2 additions & 1 deletion source/transactions/tests/abort.json
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@
"errorLabelsOmit": [
"TransientTransactionError",
"UnknownTransactionCommitResult"
]
],
"errorContains": "E11000"
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions source/transactions/tests/abort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,10 @@ tests:
document:
_id: 1
result:
# Don't assert on errorCodeName because (after SERVER-38583) the
# DuplicateKey is reported in writeErrors, not as a top-level
# command error.
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
# DuplicateKey error code included in the bulk write error message
# returned by the server
errorContains: E11000
# Make sure the server aborted the transaction.
- name: insertOne
object: collection
Expand Down
3 changes: 2 additions & 1 deletion source/transactions/tests/error-labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"errorLabelsOmit": [
"TransientTransactionError",
"UnknownTransactionCommitResult"
]
],
"errorContains": "E11000"
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions source/transactions/tests/error-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ tests:
- _id: 1
- _id: 1
result:
# Don't assert on errorCodeName because (after SERVER-38583) the
# DuplicateKey is reported in writeErrors, not as a top-level
# command error.
errorLabelsOmit: ["TransientTransactionError", "UnknownTransactionCommitResult"]
# DuplicateKey error code included in the bulk write error message
# returned by the server
errorContains: E11000
- name: abortTransaction
object: session0

Expand Down