Skip to content

Commit 82d6904

Browse files
committed
updates
1 parent 785790e commit 82d6904

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

mongo/integration/mtest/mongotest.go

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ type T struct {
128128
succeeded []*event.CommandSucceededEvent
129129
failed []*event.CommandFailedEvent
130130

131-
Client *mongo.Client
132-
// fpClient *mongo.Client
133-
DB *mongo.Database
134-
Coll *mongo.Collection
131+
Client *mongo.Client
132+
fpClient *mongo.Client
133+
DB *mongo.Database
134+
Coll *mongo.Collection
135135
}
136136

137137
func newT(wrapped *testing.T, opts ...*Options) *T {
@@ -186,7 +186,7 @@ func New(wrapped *testing.T, opts ...*Options) *T {
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)
189+
t.fpClient = t.createTestClient(t.clientOpts)
190190
}
191191

192192
wrapped.Cleanup(t.cleanup)
@@ -210,7 +210,7 @@ func (t *T) cleanup() {
210210
// always disconnect the client regardless of clientType because Client.Disconnect will work against
211211
// all deployments
212212
_ = t.Client.Disconnect(context.Background())
213-
// _ = t.fpClient.Disconnect(context.Background())
213+
_ = t.fpClient.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
@@ -243,13 +243,13 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
243243
// for shareClient, inherit the client from the parent
244244
if sub.shareClient != nil && *sub.shareClient && sub.clientType == t.clientType {
245245
sub.Client = t.Client
246-
// sub.fpClient = t.fpClient
246+
sub.fpClient = t.fpClient
247247
}
248248
// only create a client if not already set
249249
if sub.Client == nil {
250250
if sub.createClient == nil || *sub.createClient {
251251
sub.Client = sub.createTestClient(sub.clientOpts)
252-
// sub.fpClient = sub.createTestClient(sub.clientOpts)
252+
sub.fpClient = sub.createTestClient(sub.clientOpts)
253253
}
254254
}
255255
// create a collection for this test
@@ -275,7 +275,7 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
275275
// only disconnect client if it's not being shared
276276
if sub.shareClient == nil || !*sub.shareClient {
277277
_ = sub.Client.Disconnect(context.Background())
278-
// _ = sub.fpClient.Disconnect(context.Background())
278+
_ = sub.fpClient.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)
@@ -425,9 +425,9 @@ func (t *T) ResetClient(opts *options.ClientOptions) {
425425
}
426426

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

@@ -607,12 +607,7 @@ func (t *T) TrackFailPoint(fpName string) {
607607

608608
// ClearFailPoints disables all previously set failpoints for this test.
609609
func (t *T) ClearFailPoints() {
610-
clientOpts := t.clientOpts
611-
if clientOpts != nil {
612-
clientOpts.AutoEncryptionOptions = nil
613-
}
614-
client := t.createTestClient(clientOpts)
615-
db := client.Database("admin")
610+
db := t.Client.Database("admin")
616611
for _, fp := range t.failPointNames {
617612
cmd := bson.D{
618613
{"configureFailPoint", fp},

0 commit comments

Comments
 (0)