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

Provider verification fails if no consumers exist #105

Closed
steinfletcher opened this issue Dec 20, 2018 · 3 comments
Closed

Provider verification fails if no consumers exist #105

steinfletcher opened this issue Dec 20, 2018 · 3 comments

Comments

@steinfletcher
Copy link

steinfletcher commented Dec 20, 2018

Software versions

  • OS: Mac OSX 10.13.6
  • Consumer Pact library: Pact go 1.0.0-beta
  • Provider Pact library: Pact go 1.0.0-beta
  • Golang Version: 1.11.2

Expected behaviour

If no consumers have published pacts for a provider the verification should pass. When searching for tags (consumers) that don’t exist yet it might be desirable to skip the provider test, maybe displaying a warning to the console. This is a common scenario when setting up initially or when consumers haven't pushed pacts matching the tag being verified.

Actual behaviour

Pact provider verification fails with “Pact URLs is mandatory” which is a little ambiguous. This is due to the validation in func (VerifyRequest) Validate () error

Steps to reproduce

Ensure no consumers have published pacts for a given provider. Verify the provider by calling res, err := pact.VerifyProvider(…). Verification fails

Happy to submit a PR if the proposed behavior is accepted.

@webbgeorge
Copy link

Is there any update on this issue? This has recently caught me out. Thanks!

@mefellows
Copy link
Member

I don't know how I missed this, sorry! (todo: add stalebot so I don't miss it...).

Let me check, the behaviour may have been modified upstream in the verifier.

@mefellows
Copy link
Member

FYI it shouldn't cause a failure and has been since fixed in the underlying dependency.

I've also added a minor update to the way the error messages are presented in this situation, to make it clearer in cases where it's not understood what's happening.

Added flag FailIfNoPactsFound to actually fail a test if this is unexpected (in many cases, this would be unsurprising behaviour and should be an error - e.g. for standard "master" or "prod" cases).

See fdc6dca.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants