Skip to content

Commit 6441972

Browse files
committed
updates
1 parent 61ae5aa commit 6441972

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

mongo/integration/mtest/mongotest.go

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,17 @@ func New(wrapped *testing.T, opts ...*Options) *T {
176176

177177
t := newT(wrapped, opts...)
178178

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)
184184

185185
// only create a client if it needs to be shared in sub-tests
186186
// otherwise, a new client will be created for each subtest
187187
if t.shareClient != nil && *t.shareClient {
188188
t.Client = t.createTestClient(t.clientOpts)
189+
t.fpClient = t.createTestClient(t.clientOpts)
189190
}
190191

191192
wrapped.Cleanup(t.cleanup)
@@ -209,6 +210,7 @@ func (t *T) cleanup() {
209210
// always disconnect the client regardless of clientType because Client.Disconnect will work against
210211
// all deployments
211212
_ = t.Client.Disconnect(context.Background())
213+
_ = t.fpClient.Disconnect(context.Background())
212214
}
213215

214216
// 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)) {
231233
sub.AddMockResponses(sub.mockResponses...)
232234
}
233235

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+
// }
241243
// for shareClient, inherit the client from the parent
242244
if sub.shareClient != nil && *sub.shareClient && sub.clientType == t.clientType {
243245
sub.Client = t.Client
246+
sub.fpClient = t.fpClient
244247
}
245248
// only create a client if not already set
246249
if sub.Client == nil {
247250
if sub.createClient == nil || *sub.createClient {
248251
sub.Client = sub.createTestClient(sub.clientOpts)
252+
sub.fpClient = sub.createTestClient(sub.clientOpts)
249253
}
250254
}
251255
// create a collection for this test
@@ -271,6 +275,7 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
271275
// only disconnect client if it's not being shared
272276
if sub.shareClient == nil || !*sub.shareClient {
273277
_ = sub.Client.Disconnect(context.Background())
278+
_ = sub.fpClient.Disconnect(context.Background())
274279
}
275280
assert.Equal(sub, 0, sessions, "%v sessions checked out", sessions)
276281
assert.Equal(sub, 0, conns, "%v connections checked out", conns)
@@ -612,6 +617,8 @@ func (t *T) ClearFailPoints() {
612617
}
613618
}
614619
t.failPointNames = t.failPointNames[:0]
620+
// t.fpClient.Disconnect(context.Background())
621+
// t.fpClient = nil
615622
}
616623

617624
// CloneDatabase modifies the default database for this test to match the given options.

0 commit comments

Comments
 (0)