diff --git a/plugin/convert/diagnostics_test.go b/plugin/convert/diagnostics_test.go index 5825269a5..b8574dc4d 100644 --- a/plugin/convert/diagnostics_test.go +++ b/plugin/convert/diagnostics_test.go @@ -5,11 +5,19 @@ import ( "testing" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" proto "github.com/hashicorp/terraform/internal/tfplugin5" "github.com/hashicorp/terraform/tfdiags" "github.com/zclconf/go-cty/cty" ) +var ignoreUnexported = cmpopts.IgnoreUnexported( + proto.Diagnostic{}, + proto.Schema_Block{}, + proto.Schema_NestedBlock{}, + proto.Schema_Attribute{}, +) + func TestProtoDiagnostics(t *testing.T) { diags := WarnsAndErrsToProto( []string{ @@ -41,8 +49,8 @@ func TestProtoDiagnostics(t *testing.T) { }, } - if !cmp.Equal(expected, diags) { - t.Fatal(cmp.Diff(expected, diags)) + if !cmp.Equal(expected, diags, ignoreUnexported) { + t.Fatal(cmp.Diff(expected, diags, ignoreUnexported)) } } diff --git a/plugin/convert/schema_test.go b/plugin/convert/schema_test.go index 8ebf0fdd0..45e4d8eac 100644 --- a/plugin/convert/schema_test.go +++ b/plugin/convert/schema_test.go @@ -353,8 +353,8 @@ func TestConvertProtoSchemaBlocks(t *testing.T) { for name, tc := range tests { t.Run(name, func(t *testing.T) { converted := ConfigSchemaToProto(tc.Block) - if !cmp.Equal(converted, tc.Want, typeComparer, equateEmpty) { - t.Fatal(cmp.Diff(converted, tc.Want, typeComparer, equateEmpty)) + if !cmp.Equal(converted, tc.Want, typeComparer, equateEmpty, ignoreUnexported) { + t.Fatal(cmp.Diff(converted, tc.Want, typeComparer, equateEmpty, ignoreUnexported)) } }) }