Skip to content

Commit 08cfe49

Browse files
committed
updates
1 parent 82d6904 commit 08cfe49

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mongo/integration/mtest/mongotest.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ func New(wrapped *testing.T, opts ...*Options) *T {
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 {
188-
t.Client = t.createTestClient(t.clientOpts)
189188
t.fpClient = t.createTestClient(t.clientOpts)
189+
t.Client = t.createTestClient(t.clientOpts)
190190
}
191191

192192
wrapped.Cleanup(t.cleanup)
@@ -209,8 +209,8 @@ func (t *T) cleanup() {
209209

210210
// always disconnect the client regardless of clientType because Client.Disconnect will work against
211211
// all deployments
212-
_ = t.Client.Disconnect(context.Background())
213212
_ = t.fpClient.Disconnect(context.Background())
213+
_ = t.Client.Disconnect(context.Background())
214214
}
215215

216216
// 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)) {
242242
// }
243243
// for shareClient, inherit the client from the parent
244244
if sub.shareClient != nil && *sub.shareClient && sub.clientType == t.clientType {
245-
sub.Client = t.Client
246245
sub.fpClient = t.fpClient
246+
sub.Client = t.Client
247247
}
248248
// only create a client if not already set
249249
if sub.Client == nil {
250250
if sub.createClient == nil || *sub.createClient {
251-
sub.Client = sub.createTestClient(sub.clientOpts)
252251
sub.fpClient = sub.createTestClient(sub.clientOpts)
252+
sub.Client = sub.createTestClient(sub.clientOpts)
253253
}
254254
}
255255
// create a collection for this test
@@ -274,8 +274,8 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
274274
}
275275
// only disconnect client if it's not being shared
276276
if sub.shareClient == nil || !*sub.shareClient {
277-
_ = sub.Client.Disconnect(context.Background())
278277
_ = sub.fpClient.Disconnect(context.Background())
278+
_ = sub.Client.Disconnect(context.Background())
279279
}
280280
assert.Equal(sub, 0, sessions, "%v sessions checked out", sessions)
281281
assert.Equal(sub, 0, conns, "%v connections checked out", conns)
@@ -424,10 +424,10 @@ func (t *T) ResetClient(opts *options.ClientOptions) {
424424
t.clientOpts = opts
425425
}
426426

427-
_ = t.Client.Disconnect(context.Background())
428427
_ = t.fpClient.Disconnect(context.Background())
429-
t.Client = t.createTestClient(t.clientOpts)
428+
_ = t.Client.Disconnect(context.Background())
430429
t.fpClient = t.createTestClient(t.clientOpts)
430+
t.Client = t.createTestClient(t.clientOpts)
431431
t.DB = t.Client.Database(t.dbName)
432432
t.Coll = t.DB.Collection(t.collName, t.collOpts)
433433

0 commit comments

Comments
 (0)