[GODRIVER-2805] mtest: Add a way to check if all MockResponses have been consumed Created: 12/Apr/23 Updated: 27/Oct/23 Resolved: 06/Jul/23 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Testing |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Trivial - P5 |
| Reporter: | Stavros Tsompanidis | Assignee: | Qingyang Hu |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Scenario: You create a unit test with 5 mock responses, and you want to make sure that each of those responses will be consumed. Example: We have collection A and B. We want to asure in unit test, that when there is an insert on collection A, an insert on collection B will be executed. So we need a method NoRemainingMockResponses() which returns true if all mock responses had consumed. |
| Comments |
| Comment by PM Bot [ 06/Jul/23 ] | |||
|
There hasn't been any recent activity on this ticket, so we're resolving it. Thanks for reaching out! Please feel free to reopen this ticket if you're still experiencing the issue, and add a comment if you're able to provide more information. | |||
| Comment by PM Bot [ 28/Jun/23 ] | |||
|
Hi stavtsob@gmail.com! If this is still an issue for you, please open Jira to review the latest status and provide your feedback. Thanks! | |||
| Comment by Qingyang Hu [ 20/Jun/23 ] | |||
|
Hello stavtsob@gmail.com, We appreciate you bringing this issue to our attention. However, we suggest Go driver users not to use the mtest package in their projects. The mtest package mainly focuses on internal testing. Thus, it is subject to change. Instead, we plan to move mtest into an internal directory in We apologize for the inconvenience. Please feel free to leave a comment if you have more concerns. | |||
| Comment by Stavros Tsompanidis [ 18/Apr/23 ] | |||
|
I also wrote the code for this feature: File: mongo/integration/mtest/mongotest.go
| |||
| Comment by Stavros Tsompanidis [ 18/Apr/23 ] | |||
|
esha.bhargava@mongodb.com Example: We are testing a method which is updating the document of collection A. Also while updating the object A, we want to create a document in a different collection B, if some conditions are met. The creation of the document in collection B must not throw an error in case of failure. | |||
| Comment by Esha Bhargava [ 17/Apr/23 ] | |||
|
stavtsob@gmail.com Thank you for reporting this issue. Can you elaborate on what kind of interactions with the database are you trying to mock? Can you provide an example test case where you use mock responses? |