[SERVER-71512] assert.commandWorkedOrFailedWithCode unexpected behaviour with some commands Created: 21/Nov/22 Updated: 29/Oct/23 Resolved: 21/Dec/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 6.3.0-rc0, 6.0.11 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Yujin Kang Park | Assignee: | Yujin Kang Park |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Backport Requested: |
v6.0
|
||||||||||||
| Sprint: | Execution Team 2022-12-12, Execution Team 2022-12-26 | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 135 | ||||||||||||
| Description |
But not all operations, such as insert, have the 'ok' field in the response. For those operations the commandFailedWithCode branch is always taken. Possible fix:
|
| Comments |
| Comment by Githook User [ 04/Sep/23 ] |
|
Author: {'name': 'Yu Jin Kang Park', 'email': 'yujin.kang@mongodb.com', 'username': 'ykangpark'}Message: |
| Comment by Githook User [ 21/Dec/22 ] |
|
Author: {'name': 'Yu Jin Kang Park', 'email': 'yujin.kang@mongodb.com', 'username': 'ykangpark'}Message: |
| Comment by Githook User [ 20/Dec/22 ] |
|
Author: {'name': 'dziana.hurynovich', 'email': 'dziana.hurynovich@mongodb.com'}Message: Revert " This reverts commit 72b203af76e771c0705bfa657c9df76fa48c4cd5. |
| Comment by Githook User [ 19/Dec/22 ] |
|
Author: {'name': 'Yu Jin Kang Park', 'email': 'yujin.kang@mongodb.com', 'username': 'ykangpark'}Message: |
| Comment by Yujin Kang Park [ 23/Nov/22 ] |
|
charlie.swanson@mongodb.com thanks for the input! My thought was that it was wrongly assumed that all command types had the ok field, so I opened this ticket with exactly that intention, leveraging the already existing more nuanced logic within commandWorked. |
| Comment by Charlie Swanson [ 22/Nov/22 ] |
|
The assert.commandWorked() function has some more complicated/nuanced logic to see if something failed than just checking res.ok. The suggestion in the ticket seems fine to me, but just for the record and consideration, here is that other logic: |