@@ -128,10 +128,10 @@ type T struct {
128
128
succeeded []* event.CommandSucceededEvent
129
129
failed []* event.CommandFailedEvent
130
130
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
135
135
}
136
136
137
137
func newT (wrapped * testing.T , opts ... * Options ) * T {
@@ -227,7 +227,7 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
227
227
228
228
// for shareClient, inherit the client from the parent
229
229
if sub .shareClient != nil && * sub .shareClient && sub .clientType == t .clientType {
230
- sub .fpClient = t .fpClient
230
+ // sub.fpClient = t.fpClient
231
231
sub .Client = t .Client
232
232
}
233
233
// only create a client if not already set
@@ -628,13 +628,10 @@ func sanitizeCollectionName(db string, coll string) string {
628
628
}
629
629
630
630
func (t * T ) createTestClient () {
631
- var clientOpts * options. ClientOptions
632
- if t . clientOpts == nil {
631
+ clientOpts := t . clientOpts
632
+ if clientOpts == nil {
633
633
// default opts
634
634
clientOpts = options .Client ().SetWriteConcern (MajorityWc ).SetReadPreference (PrimaryRp )
635
- } else {
636
- opts := * t .clientOpts
637
- clientOpts = & opts
638
635
}
639
636
// set ServerAPIOptions to latest version if required
640
637
if clientOpts .Deployment == nil && t .clientType != Mock && clientOpts .ServerAPIOptions == nil && testContext .requireAPIVersion {
@@ -715,22 +712,23 @@ func (t *T) createTestClient() {
715
712
uriOpts = options .Client ().ApplyURI (testContext .connString .Original )
716
713
}
717
714
}
715
+ t .clientOpts = options .MergeClientOptions (uriOpts , clientOpts )
718
716
719
717
var err error
720
718
// Pass in uriOpts first so clientOpts wins if there are any conflicting settings.
721
- t .Client , err = mongo .NewClient (uriOpts , clientOpts )
719
+ t .Client , err = mongo .NewClient (t . clientOpts )
722
720
if err != nil {
723
721
t .Fatalf ("error creating client: %v" , err )
724
722
}
725
723
if err := t .Client .Connect (context .Background ()); err != nil {
726
724
t .Fatalf ("error connecting client: %v" , err )
727
725
}
728
726
729
- clientOpts .AutoEncryptionOptions = nil
730
- t .fpClient , err = mongo .NewClient (uriOpts , clientOpts )
731
- if err != nil {
732
- t .Fatalf ("error creating client: %v" , err )
733
- }
727
+ // clientOpts.AutoEncryptionOptions = nil
728
+ // t.fpClient, err = mongo.NewClient(uriOpts, clientOpts)
729
+ // if err != nil {
730
+ // t.Fatalf("error creating client: %v", err)
731
+ // }
734
732
// if err := t.fpClient.Connect(context.Background()); err != nil {
735
733
// t.Fatalf("error connecting client: %v", err)
736
734
// }
0 commit comments