-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Feature request: support option to not fail if no pacts found #941
Comments
Moving this to the core. This also came up in the slack forums recently. |
So sorry @mefellows I have no idea how I created it over here. My fault for having too many pact-foundation tabs open =( |
Ok, apologise @mefellows, noob over here. Ah so is pact-reference the core of pact (rust, ruby versions) etc? |
Exactly! |
pact-reference is where the rust core is, but the ruby core I believe is elsewhere (pact-ruby-standalone and its dependencies). |
…ts were found to verify #213
I've added a I would like to point out that this option should be used carefully. If no pacts are found due to bad configuration, this would mean the verification build will pass, but no verification results will be published. Then the can-i-deploy check would fail, even though all the builds are green. This will be very confusing for people. Even worse, if can-i-deploy is not being used, then all the builds will be green but no verification has been done. |
Awesome, thanks Ron. Noted on the risks, and I agree. It will be set to false by default. I'll move this to the Pact JS repo to implement from here. |
What does can-i-deploy do if you ask about a provider with no consumers? I don’t think it should fail- it’s safe to deploy a provider with no consumers. If it doesn’t fail, then I think pact verify with no consumers shouldn’t fail either (although I think it should warn). If pact verify fails when there are no consumers, then we can never end up deploying a provider with no consumers. For these reasons, I prefer not failing when there are no pacts found by default. If it doesn’t fail, you don’t have to special case an initial deploy. If it does fail, you do. |
@TimothyJones this was my understanding of how the previous versions of @pact-foundation/pact-js behaved. I too had understood that it is absolutely fine for provider to exist with no consumer. That is an expected scenario, especially when teams are starting off with Pact or creating new provider services. |
Yep, it's just that once you have consumers it's harder to detect this use case without additional checks. That could be worth exploring. e.g. If there are consumers of a provider, but no pacts are found, this is probably a configuration issue. If there are no consumers, then you'd always expect an empty list of pacts to verify. cc: @bethesque |
@mefellows yeah it makes sense, it's a bit of a tricky one to get right with the same 'solution' for both issues. |
Hey is there any movement on this issue that anyone knows about? This is stopping me rolling out v10 of this package as we cannot establish providers before there are pact for it to verify. It's a bit of a big blocker for our pipelines as we can't create consumer pacts before the provider exists and have them be deployable, and we can't create providers before the consumer pacts exists to verify with v10. Can I help out at all? |
Hi Adam. The Pact core now supports the feature via the We first need to expose this C interface to Node:
Then we can add the types to the core:
Once released, this will make the type available to Pact JS :) |
Closed, the PR above completes this feature. |
Software versions
Issue Checklist
Please confirm the following:
Expected behaviour
When a provider does not find any pacts to verify the verification resolves with the relevant output describing the result. This means any test libraries do not fail as the promise is resolved.
Actual behaviour
When a provider does not find any pacts to verify for the consumer version selectors, an error inside the Rust pact_verifier is failing the verification run.
Steps to reproduce
Relevant log files
debug.log
The text was updated successfully, but these errors were encountered: