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) {
588
588
589
589
// ClearFailPoints disables all previously set failpoints for this test.
590
590
func (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
+ }()
596
603
}
597
- defer func () {
598
- _ = client .Disconnect (context .Background ())
599
- }()
600
604
db := client .Database ("admin" )
601
605
for _ , fp := range t .failPointNames {
602
606
cmd := bson.D {
603
607
{"configureFailPoint" , fp },
604
608
{"mode" , "off" },
605
609
}
606
- err : = db .RunCommand (context .Background (), cmd ).Err ()
610
+ err = db .RunCommand (context .Background (), cmd ).Err ()
607
611
if err != nil {
608
612
t .Fatalf ("error clearing fail point %s: %v" , fp , err )
609
613
}
You can’t perform that action at this time.
0 commit comments