-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
Use Case
As a Node.js engineer
I want a unified test runner that propagates the errors from operations inside the callback to the withTransaction API
So that I can run assertions on the outcome of withTransaction as expected
User Experience
- None
Dependencies
- Unified test runner
Risks/Unknowns
- Not sure if this will break some tests, but they never would've been asserting the correct behavior anyway
Acceptance Criteria
Implementation Requirements
- Adjust the executeOperationAndCheck helper to rethrow any errors it encounters if requested
Testing Requirements
- Write a test that used the withTransaction operation and test that you can obtain the same error an operation was made to throw inside the callback
- Expect that there is an abortTransaction command event as a result of the error
Documentation Requirements
- None
Follow Up Requirements
- None
Reference
- https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.md#withtransaction
Test runners MUST allow any errors from the callback operation(s) to propagate to withTransaction, irrespective of ignoreResultAndError or expectError. For example, if a callback operation raises an error, it should be possible to assert that error at both the callback operation and withTransaction level.