Skip to content

Commit

Permalink
tfsdk: Handle []*tfprotov6.Diagnostic check in TestServerPlanResource…
Browse files Browse the repository at this point in the history
…Change
  • Loading branch information
bflad committed Sep 1, 2021
1 parent 7b38150 commit cdee112
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tfsdk/serve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/internal/diagnostics"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
"github.com/hashicorp/terraform-plugin-go/tftypes"
Expand Down Expand Up @@ -2648,8 +2647,10 @@ func TestServerPlanResourceChange(t *testing.T) {
if diff := cmp.Diff(got.Diagnostics, tc.expectedDiags); diff != "" {
t.Errorf("Unexpected diff in diagnostics (+wanted, -got): %s", diff)
}
if diagnostics.DiagsHasErrors(got.Diagnostics) {
return
for _, diagnostic := range got.Diagnostics {
if diagnostic != nil && diagnostic.Severity == tfprotov6.DiagnosticSeverityError {
return
}
}
gotPlannedState, err := got.PlannedState.Unmarshal(tc.resourceType)
if err != nil {
Expand Down

0 comments on commit cdee112

Please sign in to comment.