Skip to content

Commit

Permalink
Un-export mt.Close
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdale committed Aug 9, 2023
1 parent 107b807 commit 15c786d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions mongo/integration/mtest/mongotest.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,14 @@ func New(wrapped *testing.T, opts ...*Options) *T {
t.createTestClient()
}

wrapped.Cleanup(t.Close)
wrapped.Cleanup(t.cleanup)

return t
}

// Close cleans up any resources associated with a T.
//
// Deprecated: Close is now called automatically by [testing.T.Cleanup] at the
// end of a test, so it does not need to be called explicitly. It is safe to
// call multiple times.
func (t *T) Close() {
// cleanup cleans up any resources associated with a T. It is intended to be
// called by [testing.T.Cleanup].
func (t *T) cleanup() {
if t.Client == nil {
return
}
Expand All @@ -204,9 +201,6 @@ func (t *T) Close() {
// always disconnect the client regardless of clientType because Client.Disconnect will work against
// all deployments
_ = t.Client.Disconnect(context.Background())

// Set the Client to nil so that subsequent calls to Close have no effect.
t.Client = nil
}

// Run creates a new T instance for a sub-test and runs the given callback. It also creates a new collection using the
Expand Down

0 comments on commit 15c786d

Please sign in to comment.