[GODRIVER-2876] Automatically clean up "mtest" resources Created: 23/Jun/23  Updated: 06/Dec/23  Resolved: 14/Aug/23

Status: Closed
Project: Go Driver
Component/s: Testing
Affects Version/s: None
Fix Version/s: 1.13.0, 1.13.1

Type: Improvement Priority: Major - P3
Reporter: Matt Dale Assignee: Matt Dale
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Documentation Changes: Not Needed
Documentation Changes Summary:

1. What would you like to communicate to the user about this feature?
2. Would you like the user to see examples of the syntax and/or executable code and its output?
3. Which versions of the driver/connector does this apply to?


 Description   

Currently all tests must run defer mt.Close after calling mtest.New to make sure mtest cleans up all of the server-side resources it created to run the test. That pattern is error-prone, possibly leading to tests that don't clean up server-side resources.

Instead, we should make the cleanup process automatic by using T.Cleanup and remove mt.Close.

Definition of done:

  • Register the mtest cleanup logic as an automatic test cleanup task using T.Cleanup.
  • Remove the mtest.T.Close function and all references.


 Comments   
Comment by Githook User [ 14/Aug/23 ]

Author:

{'name': 'Matt Dale', 'email': '9760375+matthewdale@users.noreply.github.com', 'username': 'matthewdale'}

Message: GODRIVER-2876 Automatically clean up mtest resources. (#1347)
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/6a788f92affbc24d022e0d0a6ac94d5c29cf521b

Comment by Matt Dale [ 08/Aug/23 ]

PR: https://github.com/mongodb/mongo-go-driver/pull/1347

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