#397 10.X.X provider verification fails when there are no pacts to verify
Issue created by
adamwitko
Software versions
•
OS: Mac OSX 12.3
•
Consumer Pact library: @pact-foundation/pact@10.1.1
•
Provider Pact library: @pact-foundation/pact@10.1.1
•
Pact Node version: @pact-foundation/pact-core@13.7.7
•
Node Version: 18.7.0
Issue Checklist
Please confirm the following:
☑︎ I have upgraded to the latest
☑︎ I have the read the FAQs in the Readme
☑︎ I have triple checked, that there are
no unhandled promises in my code and have
read the section on intermittent test failures
☑︎ I have set my log level to debug and attached a log file showing the complete request/response cycle
☐ For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem
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.
In @pact-foundation/pact@^9 this would not reject and allow a provider to exist and attempt to verify contracts before any consumers contracts have been published for the matching consumer version selectors.
Steps to reproduce
• Set your options to a standard looking configuration such as the following where there are no consumer pacts published that match the consumerVersionSelectors defined:
const verifierOptions = {
publishVerificationResult: false,
provider: 'my-service',
providerBaseUrl: '<http://localhost:8000>',
providerVersion: '09fe6815',
providerBranch: 'my-branch',
logLevel: 'debug',
pactBrokerUrl: '<https://my-broker/>',
enablePending: true,
consumerVersionSelectors: [
{ mainBranch: true },
{ deployedOrReleased: true },
{ matchingBranch: true }
],
}
await new Verifier(verifierOptions).verifyProvider()
Relevant log files
debug.log
pact-foundation/pact-js-core