@@ -176,12 +176,14 @@ func New(wrapped *testing.T, opts ...*Options) *T {
176
176
177
177
t := newT (wrapped , opts ... )
178
178
179
- t .fpClient = t .createTestClient ()
179
+ fpOpt := t .clientOpts
180
+ fpOpt .AutoEncryptionOptions = nil
181
+ t .fpClient = t .createTestClient (fpOpt )
180
182
181
183
// only create a client if it needs to be shared in sub-tests
182
184
// otherwise, a new client will be created for each subtest
183
185
if t .shareClient != nil && * t .shareClient {
184
- t .Client = t .createTestClient ()
186
+ t .Client = t .createTestClient (t . clientOpts )
185
187
}
186
188
187
189
wrapped .Cleanup (t .cleanup )
@@ -237,7 +239,7 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
237
239
// only create a client if not already set
238
240
if sub .Client == nil {
239
241
if sub .createClient == nil || * sub .createClient {
240
- sub .Client = sub .createTestClient ()
242
+ sub .Client = sub .createTestClient (t . clientOpts )
241
243
}
242
244
}
243
245
// create a collection for this test
@@ -412,7 +414,7 @@ func (t *T) ResetClient(opts *options.ClientOptions) {
412
414
}
413
415
414
416
_ = t .Client .Disconnect (context .Background ())
415
- t .Client = t .createTestClient ()
417
+ t .Client = t .createTestClient (t . clientOpts )
416
418
t .DB = t .Client .Database (t .dbName )
417
419
t .Coll = t .DB .Collection (t .collName , t .collOpts )
418
420
@@ -631,8 +633,7 @@ func sanitizeCollectionName(db string, coll string) string {
631
633
return coll
632
634
}
633
635
634
- func (t * T ) createTestClient () * mongo.Client {
635
- clientOpts := t .clientOpts
636
+ func (t * T ) createTestClient (clientOpts * options.ClientOptions ) * mongo.Client {
636
637
if clientOpts == nil {
637
638
// default opts
638
639
clientOpts = options .Client ().SetWriteConcern (MajorityWc ).SetReadPreference (PrimaryRp )
0 commit comments