File tree Expand file tree Collapse file tree 4 files changed +78
-0
lines changed
Expand file tree Collapse file tree 4 files changed +78
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ func (p *GRPCProvider) GetProviderSchema() providers.GetProviderSchemaResponse {
142142 }
143143 }
144144
145+ resp .Diagnostics = resp .Diagnostics .Append (convert .ProtoToDiagnostics (identResp .Diagnostics ))
146+ if resp .Diagnostics .HasErrors () {
147+ return resp
148+ }
149+
145150 resp .Provider = convert .ProtoToProviderSchema (protoResp .Provider , nil )
146151 if protoResp .ProviderMeta == nil {
147152 logger .Debug ("No provider meta schema returned" )
Original file line number Diff line number Diff line change @@ -272,6 +272,40 @@ func TestGRPCProvider_GetSchema_IdentityUnimplemented(t *testing.T) {
272272 checkDiags (t , resp .Diagnostics )
273273}
274274
275+ func TestGRPCProvider_GetSchema_IdentityErrorDiagnostic (t * testing.T ) {
276+ ctrl := gomock .NewController (t )
277+ client := mockproto .NewMockProviderClient (ctrl )
278+
279+ client .EXPECT ().GetSchema (
280+ gomock .Any (),
281+ gomock .Any (),
282+ gomock .Any (),
283+ ).Return (providerProtoSchema (), nil )
284+
285+ client .EXPECT ().GetResourceIdentitySchemas (
286+ gomock .Any (),
287+ gomock .Any (),
288+ gomock .Any (),
289+ ).Return (& proto.GetResourceIdentitySchemas_Response {
290+ Diagnostics : []* proto.Diagnostic {
291+ {
292+ Severity : proto .Diagnostic_ERROR ,
293+ Summary : "error summary" ,
294+ Detail : "error detail" ,
295+ },
296+ },
297+ IdentitySchemas : map [string ]* proto.ResourceIdentitySchema {},
298+ }, nil )
299+
300+ p := & GRPCProvider {
301+ client : client ,
302+ }
303+
304+ resp := p .GetProviderSchema ()
305+
306+ checkDiagsHasError (t , resp .Diagnostics )
307+ }
308+
275309func TestGRPCProvider_GetResourceIdentitySchemas (t * testing.T ) {
276310 ctrl := gomock .NewController (t )
277311 client := mockproto .NewMockProviderClient (ctrl )
Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ func (p *GRPCProvider) GetProviderSchema() providers.GetProviderSchemaResponse {
142142 }
143143 }
144144
145+ resp .Diagnostics = resp .Diagnostics .Append (convert .ProtoToDiagnostics (identResp .Diagnostics ))
146+ if resp .Diagnostics .HasErrors () {
147+ return resp
148+ }
149+
145150 resp .Provider = convert .ProtoToProviderSchema (protoResp .Provider , nil )
146151 if protoResp .ProviderMeta == nil {
147152 logger .Debug ("No provider meta schema returned" )
Original file line number Diff line number Diff line change @@ -279,6 +279,40 @@ func TestGRPCProvider_GetSchema_IdentityUnimplemented(t *testing.T) {
279279 checkDiags (t , resp .Diagnostics )
280280}
281281
282+ func TestGRPCProvider_GetSchema_IdentityErrorDiagnostic (t * testing.T ) {
283+ ctrl := gomock .NewController (t )
284+ client := mockproto .NewMockProviderClient (ctrl )
285+
286+ client .EXPECT ().GetProviderSchema (
287+ gomock .Any (),
288+ gomock .Any (),
289+ gomock .Any (),
290+ ).Return (providerProtoSchema (), nil )
291+
292+ client .EXPECT ().GetResourceIdentitySchemas (
293+ gomock .Any (),
294+ gomock .Any (),
295+ gomock .Any (),
296+ ).Return (& proto.GetResourceIdentitySchemas_Response {
297+ Diagnostics : []* proto.Diagnostic {
298+ {
299+ Severity : proto .Diagnostic_ERROR ,
300+ Summary : "error summary" ,
301+ Detail : "error detail" ,
302+ },
303+ },
304+ IdentitySchemas : map [string ]* proto.ResourceIdentitySchema {},
305+ }, nil )
306+
307+ p := & GRPCProvider {
308+ client : client ,
309+ }
310+
311+ resp := p .GetProviderSchema ()
312+
313+ checkDiagsHasError (t , resp .Diagnostics )
314+ }
315+
282316func TestGRPCProvider_GetResourceIdentitySchemas (t * testing.T ) {
283317 ctrl := gomock .NewController (t )
284318 client := mockproto .NewMockProviderClient (ctrl )
You can’t perform that action at this time.
0 commit comments