Skip to content

Commit 7502f77

Browse files
committed
updates
1 parent 5d913fe commit 7502f77

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

mongo/integration/mtest/mongotest.go

Lines changed: 14 additions & 16 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 {
@@ -227,7 +227,7 @@ func (t *T) RunOpts(name string, opts *Options, callback func(mt *T)) {
227227

228228
// for shareClient, inherit the client from the parent
229229
if sub.shareClient != nil && *sub.shareClient && sub.clientType == t.clientType {
230-
sub.fpClient = t.fpClient
230+
// sub.fpClient = t.fpClient
231231
sub.Client = t.Client
232232
}
233233
// only create a client if not already set
@@ -628,13 +628,10 @@ func sanitizeCollectionName(db string, coll string) string {
628628
}
629629

630630
func (t *T) createTestClient() {
631-
var clientOpts *options.ClientOptions
632-
if t.clientOpts == nil {
631+
clientOpts := t.clientOpts
632+
if clientOpts == nil {
633633
// default opts
634634
clientOpts = options.Client().SetWriteConcern(MajorityWc).SetReadPreference(PrimaryRp)
635-
} else {
636-
opts := *t.clientOpts
637-
clientOpts = &opts
638635
}
639636
// set ServerAPIOptions to latest version if required
640637
if clientOpts.Deployment == nil && t.clientType != Mock && clientOpts.ServerAPIOptions == nil && testContext.requireAPIVersion {
@@ -715,22 +712,23 @@ func (t *T) createTestClient() {
715712
uriOpts = options.Client().ApplyURI(testContext.connString.Original)
716713
}
717714
}
715+
t.clientOpts = options.MergeClientOptions(uriOpts, clientOpts)
718716

719717
var err error
720718
// 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)
722720
if err != nil {
723721
t.Fatalf("error creating client: %v", err)
724722
}
725723
if err := t.Client.Connect(context.Background()); err != nil {
726724
t.Fatalf("error connecting client: %v", err)
727725
}
728726

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+
// }
734732
// if err := t.fpClient.Connect(context.Background()); err != nil {
735733
// t.Fatalf("error connecting client: %v", err)
736734
// }

0 commit comments

Comments
 (0)