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

Please document how to run a verification using the provider name and consumer version selectors #285

Open
bethesque opened this issue Jan 27, 2022 · 2 comments
Assignees

Comments

@bethesque
Copy link
Member

I'm trying to find an example for someone because I'm not familiar with the python CLI/API and I can't find one anywhere!

@YOU54F
Copy link
Member

YOU54F commented May 3, 2023

It would be good to hook this project up with a python verifier over using the pact-cli

https://github.com/pactflow/example-provider-python

which can be hooked up with this consumer project

https://github.com/pactflow/example-consumer-python

options documented in #346

source code tests here

where the verifier e2e tests live here

We would happily accept contributions to improve the examples, either in this repo, the pactflow examples, or in a pact python workshop (to anyone reading this!)

@YOU54F
Copy link
Member

YOU54F commented Aug 3, 2023

Main docs https://docs.pact.io/pact_broker/advanced_topics/consumer_version_selectors

Python Example

verifier = Verifier(
    provider="Your provider",
    broker_url="...",
    consumer_version_selectors=[
        {"mainBranch": True}, # (recommended) - Returns the pacts for consumers configured mainBranch property
        {"deployedOrReleased": True}, # (recommended) - Returns the pacts for all versions of the consumer that are currently deployed or released and currently supported in any environment.
        {"deployed": "test"}, # Normally, this would not be needed, Any versions currently deployed to the specified environment.
        {"deployed": "production"}, # Normally, this would not be needed, Any versions currently deployed to the specified environment.
        {"environment": "test"}, #  Normally, this would not be needed, Any versions currently deployed or released and supported in the specified environment.
        {"environment": "production"}, #  Normally, this would not be needed, Any versions currently deployed or released and supported in the specified environment.
    ],
    # ...
)

Taken from my WIP code sample updates on the website - which shows snippets in other languages, and other selectors

https://deploy-preview-189--docs-pact-io.netlify.app/pact_broker/samples_provider_verification_provider_changed#consumer-version-selectors---code-examples-with-branches

pact-foundation/docs.pact.io#189

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

Successfully merging a pull request may close this issue.

4 participants