@@ -185,8 +185,8 @@ func New(wrapped *testing.T, opts ...*Options) *T {
185
185
// only create a client if it needs to be shared in sub-tests
186
186
// otherwise, a new client will be created for each subtest
187
187
if t .shareClient != nil && * t .shareClient {
188
- t .Client = t .createTestClient (t .clientOpts )
189
188
t .fpClient = t .createTestClient (t .clientOpts )
189
+ t .Client = t .createTestClient (t .clientOpts )
190
190
}
191
191
192
192
wrapped .Cleanup (t .cleanup )
@@ -209,8 +209,8 @@ func (t *T) cleanup() {
209
209
210
210
// always disconnect the client regardless of clientType because Client.Disconnect will work against
211
211
// all deployments
212
- _ = t .Client .Disconnect (context .Background ())
213
212
_ = t .fpClient .Disconnect (context .Background ())
213
+ _ = t .Client .Disconnect (context .Background ())
214
214
}
215
215
216
216
// Run creates a new T instance for a sub-test and runs the given callback. It also creates a new collection using the
@@ -242,14 +242,14 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
242
242
// }
243
243
// for shareClient, inherit the client from the parent
244
244
if sub .shareClient != nil && * sub .shareClient && sub .clientType == t .clientType {
245
- sub .Client = t .Client
246
245
sub .fpClient = t .fpClient
246
+ sub .Client = t .Client
247
247
}
248
248
// only create a client if not already set
249
249
if sub .Client == nil {
250
250
if sub .createClient == nil || * sub .createClient {
251
- sub .Client = sub .createTestClient (sub .clientOpts )
252
251
sub .fpClient = sub .createTestClient (sub .clientOpts )
252
+ sub .Client = sub .createTestClient (sub .clientOpts )
253
253
}
254
254
}
255
255
// create a collection for this test
@@ -274,8 +274,8 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
274
274
}
275
275
// only disconnect client if it's not being shared
276
276
if sub .shareClient == nil || ! * sub .shareClient {
277
- _ = sub .Client .Disconnect (context .Background ())
278
277
_ = sub .fpClient .Disconnect (context .Background ())
278
+ _ = sub .Client .Disconnect (context .Background ())
279
279
}
280
280
assert .Equal (sub , 0 , sessions , "%v sessions checked out" , sessions )
281
281
assert .Equal (sub , 0 , conns , "%v connections checked out" , conns )
@@ -424,10 +424,10 @@ func (t *T) ResetClient(opts *options.ClientOptions) {
424
424
t .clientOpts = opts
425
425
}
426
426
427
- _ = t .Client .Disconnect (context .Background ())
428
427
_ = t .fpClient .Disconnect (context .Background ())
429
- t . Client = t .createTestClient ( t . clientOpts )
428
+ _ = t .Client . Disconnect ( context . Background () )
430
429
t .fpClient = t .createTestClient (t .clientOpts )
430
+ t .Client = t .createTestClient (t .clientOpts )
431
431
t .DB = t .Client .Database (t .dbName )
432
432
t .Coll = t .DB .Collection (t .collName , t .collOpts )
433
433
0 commit comments