Skip to content
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

10.X.X provider verification fails when there are no pacts to verify #397

Closed
4 of 5 tasks
adamwitko opened this issue Aug 15, 2022 · 2 comments
Closed
4 of 5 tasks
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@adamwitko
Copy link
Contributor

adamwitko commented Aug 15, 2022

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

@adamwitko adamwitko added the bug Indicates an unexpected problem or unintended behavior label Aug 15, 2022
@mefellows
Copy link
Member

Apologies for any confusion Adam. I moved it to pact-foundation/pact-js#941 as it needs addressing there first. I'll perhaps leave this as a tracking item for now.

@mefellows
Copy link
Member

I'm going to retract my previous statement - please follow the above issue for exposing this in Pact JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants