Skip to content

Commit aa6793d

Browse files
committed
handle diags returned from Configure
1 parent 8c60a2c commit aa6793d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

helper/resource/testing.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
2222
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
2323
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/addrs"
24+
"github.com/hashicorp/terraform-plugin-sdk/v2/internal/diagutils"
2425
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
2526
)
2627

@@ -556,9 +557,9 @@ func Test(t TestT, c TestCase) {
556557

557558
// Auto-configure all providers.
558559
for _, p := range providers {
559-
err = p.Configure(context.Background(), terraform.NewResourceConfigRaw(nil))
560-
if err != nil {
561-
t.Fatal(err)
560+
diags := p.Configure(context.Background(), terraform.NewResourceConfigRaw(nil))
561+
if diags.HasError() {
562+
t.Fatal("error configuring provider: %s", diagutils.ErrorDiags(diags))
562563
}
563564
}
564565

0 commit comments

Comments
 (0)