[SERVER-56497] Add assert.throwsCode shell helper for testing Created: 29/Apr/21  Updated: 29/Oct/23  Resolved: 11/Jun/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Charlie Swanson Assignee: Sebastien Mendez
Resolution: Fixed Votes: 1
Labels: neweng, quick-tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Query Execution 2021-05-31, Query Execution 2021-06-14, Query Execution 2021-06-28
Participants:

 Description   

We have a helper assert.throws() which returns the error which was thrown. A common pattern looks like this:

let err = assert.throws(() => coll.aggregate(...));
assert.eq(err.code, expectedCode);

We should add a helper to the assertion library to condense this and simplify some of our tests. It will be a good counterpart to assert.commandFailedWithCode.



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 11/Jun/21 ]

Author:

{'name': 'Sebastien Mendez', 'email': 'sebastien.mendez@mongodb.com'}

Message: SERVER-56497 Add assert.throwsCode shell helper for testing
Branch: master
https://github.com/mongodb/mongo/commit/1dbdd89ea20ad7d4f5c6f7e8953d2348bc336270

Comment by Ethan Zhang (Inactive) [ 11/May/21 ]

Vote +1

Generated at Thu Feb 08 05:39:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.