-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Distinguish technical failures when verifying pacts #505
Comments
Yeah I think having some extra info would be useful as to why verification failed. Obviously it would still throw an exception but you could choose to catch and ignore certain exceptions in this specific use case. As you say, this would need changes to the core library instead of PactNet specifically at first, so it's probably best raising an issue there and linking here so it can be implemented once it's supported in FFI. |
@adamrodger is pact-foundation/pact-reference#132 relevant? |
No, that was an issue whereby FFI always logged directly to stdout so you couldn't report the failure logs in test output, and that was sorted quite a while ago. |
Having a look at the FFI code a bit (apologies, not a rust developer)
My rust-foo isn't good enough to work out what |
@adamrodger could you review whether the "upstream" label is still relevant based on my previous comment? |
…ference schema Schema used: https://github.com/pact-foundation/pact-reference/blob/45914c088a9b2e5030d8d3b5d847be73cbed1e67/rust/pact_verifier/src/verifier-results.schema.json Generated using `nswag jsonschema2csclient` (see https://github.com/RicoSuter/NSwag/releases)
…on which includes the VerificationExecutionResult
I've opened a PR: #508 |
As provider, when we verify ourselves against published consumer Pacts (
IPactVerifierSource::Verify
), aPactFailureException
can be thrown.This exception doesn't distinguish between
This is an important distinction - we'd like to fail our build if there are technical failures while self-evaluating against contracts, however if we simply don't honour a given contract then that's not reason to fail the build (the contract compatibilty will be published to the broker and we'll rely on
can-i-deploy
at deployment time).Probably the simplest thing would be to introduce fields to
PactFailureException
providing more information on what happened (which contracts failed, what the status codes were etc). That shouldn't be a breaking change 🤞No obvious downsides, other than the plumbing needed to pass the data in. As mentioned on the Slack, we might want something in core so that other implementations (not just dotnet) can benefit.
Describe alternatives you've considered
As a workaround, we've added a custom logging sink to our server when it evaluates the contracts. If any errors are logged then we fail the unit test (we're following the recommended approach whereby contract compatibility is evaluated in a unit test during the build).
Additional context
This came about because our provider codebase mocks/stubs various services when evaluating itself against Pact contracts. We were missing some stub setup calls, resulting in errors being logged / 500 responses.
The text was updated successfully, but these errors were encountered: