Skip to content

Commit ea9c262

Browse files
committed
updates
1 parent 279a764 commit ea9c262

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

mongo/integration/mtest/mongotest.go

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

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

179-
t.fpClient = t.createTestClient()
179+
fpOpt := t.clientOpts
180+
fpOpt.AutoEncryptionOptions = nil
181+
t.fpClient = t.createTestClient(fpOpt)
180182

181183
// only create a client if it needs to be shared in sub-tests
182184
// otherwise, a new client will be created for each subtest
183185
if t.shareClient != nil && *t.shareClient {
184-
t.Client = t.createTestClient()
186+
t.Client = t.createTestClient(t.clientOpts)
185187
}
186188

187189
wrapped.Cleanup(t.cleanup)
@@ -237,7 +239,7 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
237239
// only create a client if not already set
238240
if sub.Client == nil {
239241
if sub.createClient == nil || *sub.createClient {
240-
sub.Client = sub.createTestClient()
242+
sub.Client = sub.createTestClient(t.clientOpts)
241243
}
242244
}
243245
// create a collection for this test
@@ -412,7 +414,7 @@ func (t *T) ResetClient(opts *options.ClientOptions) {
412414
}
413415

414416
_ = t.Client.Disconnect(context.Background())
415-
t.Client = t.createTestClient()
417+
t.Client = t.createTestClient(t.clientOpts)
416418
t.DB = t.Client.Database(t.dbName)
417419
t.Coll = t.DB.Collection(t.collName, t.collOpts)
418420

@@ -631,8 +633,7 @@ func sanitizeCollectionName(db string, coll string) string {
631633
return coll
632634
}
633635

634-
func (t *T) createTestClient() *mongo.Client {
635-
clientOpts := t.clientOpts
636+
func (t *T) createTestClient(clientOpts *options.ClientOptions) *mongo.Client {
636637
if clientOpts == nil {
637638
// default opts
638639
clientOpts = options.Client().SetWriteConcern(MajorityWc).SetReadPreference(PrimaryRp)

0 commit comments

Comments
 (0)