File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -588,22 +588,26 @@ func (t *T) TrackFailPoint(fpName string) {
588588
589589// ClearFailPoints disables all previously set failpoints for this test.
590590func (t * T ) ClearFailPoints () {
591- clientOpts := * t .clientOpts
592- clientOpts .AutoEncryptionOptions = nil
593- client , err := mongo .NewClient (& clientOpts )
594- if err != nil {
595- t .Fatalf ("error creating client: %v" , err )
591+ var err error
592+ client := t .Client
593+ if t .clientOpts .AutoEncryptionOptions != nil {
594+ clientOpts := * t .clientOpts
595+ clientOpts .AutoEncryptionOptions = nil
596+ client , err = mongo .NewClient (& clientOpts )
597+ if err != nil {
598+ t .Fatalf ("error creating client: %v" , err )
599+ }
600+ defer func () {
601+ _ = client .Disconnect (context .Background ())
602+ }()
596603 }
597- defer func () {
598- _ = client .Disconnect (context .Background ())
599- }()
600604 db := client .Database ("admin" )
601605 for _ , fp := range t .failPointNames {
602606 cmd := bson.D {
603607 {"configureFailPoint" , fp },
604608 {"mode" , "off" },
605609 }
606- err : = db .RunCommand (context .Background (), cmd ).Err ()
610+ err = db .RunCommand (context .Background (), cmd ).Err ()
607611 if err != nil {
608612 t .Fatalf ("error clearing fail point %s: %v" , fp , err )
609613 }
You can’t perform that action at this time.
0 commit comments