@@ -176,16 +176,17 @@ func New(wrapped *testing.T, opts ...*Options) *T {
176
176
177
177
t := newT (wrapped , opts ... )
178
178
179
- fpOpt := t .clientOpts
180
- if fpOpt != nil {
181
- fpOpt .AutoEncryptionOptions = nil
182
- }
183
- t .fpClient = t .createTestClient (fpOpt )
179
+ // fpOpt := t.clientOpts
180
+ // if fpOpt != nil {
181
+ // fpOpt.AutoEncryptionOptions = nil
182
+ // }
183
+ // t.fpClient = t.createTestClient(fpOpt)
184
184
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
188
t .Client = t .createTestClient (t .clientOpts )
189
+ t .fpClient = t .createTestClient (t .clientOpts )
189
190
}
190
191
191
192
wrapped .Cleanup (t .cleanup )
@@ -209,6 +210,7 @@ func (t *T) cleanup() {
209
210
// always disconnect the client regardless of clientType because Client.Disconnect will work against
210
211
// all deployments
211
212
_ = t .Client .Disconnect (context .Background ())
213
+ _ = t .fpClient .Disconnect (context .Background ())
212
214
}
213
215
214
216
// Run creates a new T instance for a sub-test and runs the given callback. It also creates a new collection using the
@@ -231,21 +233,23 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
231
233
sub .AddMockResponses (sub .mockResponses ... )
232
234
}
233
235
234
- if sub .fpClient == nil {
235
- clientOpts := sub .clientOpts
236
- if clientOpts != nil {
237
- clientOpts .AutoEncryptionOptions = nil
238
- }
239
- sub .fpClient = sub .createTestClient (clientOpts )
240
- }
236
+ // if sub.fpClient == nil {
237
+ // clientOpts := sub.clientOpts
238
+ // if clientOpts != nil {
239
+ // clientOpts.AutoEncryptionOptions = nil
240
+ // }
241
+ // sub.fpClient = sub.createTestClient(clientOpts)
242
+ // }
241
243
// for shareClient, inherit the client from the parent
242
244
if sub .shareClient != nil && * sub .shareClient && sub .clientType == t .clientType {
243
245
sub .Client = t .Client
246
+ sub .fpClient = t .fpClient
244
247
}
245
248
// only create a client if not already set
246
249
if sub .Client == nil {
247
250
if sub .createClient == nil || * sub .createClient {
248
251
sub .Client = sub .createTestClient (sub .clientOpts )
252
+ sub .fpClient = sub .createTestClient (sub .clientOpts )
249
253
}
250
254
}
251
255
// create a collection for this test
@@ -271,6 +275,7 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
271
275
// only disconnect client if it's not being shared
272
276
if sub .shareClient == nil || ! * sub .shareClient {
273
277
_ = sub .Client .Disconnect (context .Background ())
278
+ _ = sub .fpClient .Disconnect (context .Background ())
274
279
}
275
280
assert .Equal (sub , 0 , sessions , "%v sessions checked out" , sessions )
276
281
assert .Equal (sub , 0 , conns , "%v connections checked out" , conns )
@@ -612,6 +617,8 @@ func (t *T) ClearFailPoints() {
612
617
}
613
618
}
614
619
t .failPointNames = t .failPointNames [:0 ]
620
+ // t.fpClient.Disconnect(context.Background())
621
+ // t.fpClient = nil
615
622
}
616
623
617
624
// CloneDatabase modifies the default database for this test to match the given options.
0 commit comments