pactflow / pact-protobuf-plugin

Pact plugin for Protobufs and gRPC
MIT License
16 stars 8 forks source link

support gRPC error model #25

Open scoplin opened 1 year ago

scoplin commented 1 year ago

On my team, I encourage the use of well-defined gRPC status codes when applicable. It seems to me that these codes can be meaningful in a contract. For example, we could use NOT_FOUND as a means to communicate non-existence of an entity. If the provider changed behavior to return INVALID_ARGUMENT instead in the same situation it would clearly break clients.

I would like to have a way to express expectations of status codes in consumer tests and validate those expectations in the provider tests. It doesn't seem like this is currently possible based upon this code and lack of success finding examples.

Beyond the basic support for error codes, it may also be useful to consider how the gRPC richer error model could play into contract-based testing as well. Google provides structured messages (with presumably implied contracts of their own) for many common error scenarios.

github-actions[bot] commented 1 year ago

👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1049). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.

See our documentation for more information.

rholshausen commented 1 year ago

0.3.1 supports verifying gRPC statues and messages. Refer to https://github.com/pactflow/pact-protobuf-plugin#verifying-grpc-error-responses-031