Pact Provider Verification
This setup simplifies Pact Provider verification process in any language, wrapping the Ruby implementation into a cross-platform, binary-like CLI tool.
Features:
- Verify Pacts against Pacts published to an http endpoint, such as a Pact Broker
- Verify local
*.json
Pacts on the file system - Works with Pact provider states should you need them
Installation
Native Installation
Download the appropriate release
for your OS and put somewhere on your PATH
.
With Ruby on Mac OSX and Linux
gem install pact-provider-verifier
pact-provider-verifier <args>
Run pact-provider-verifier help
for command line options.
Examples
See the examples directory for a real working API example:
cd examples
./test.sh
Simple API
Steps:
- Create an API and a corresponding Docker image for it
- Publish Pacts to the Pact broker (or create local ones)
- Run the CLI tool for your OS, passing the appropriate flags:
--pact_urls
- a comma delimited list of local Pact file urls or Pact Broker URLs.--provider_base_url
- the base url of the pact provider (i.e. your API)
API with Provider States
Execute pact provider verification against a provider which implements the following:
-
an http get endpoint which returns pact provider_states by consumer
{ "myConsumer": [ "customer is logged in", "customer has a million dollars" ] }
-
an http post endpoint which sets the active pact consumer and provider state
consumer=web&state=customer%20is%20logged%20in
The following flags are required:
--pact-urls
- a comma delimited list of pact file urls--provider-base-url
- the base url of the pact provider--provider-states-url
- the full url of the endpoint which returns provider states by consumer--provider-states-setup-url
- the full url of the endpoint which sets the active pact consumer and provider state
Using the Pact Broker with Basic authentication
The following flags are required to use basic authentication with a Pact Broker:
--broker-user
- the Username for Pact Broker basic authentication.--broker-password
- the Password for Pact Broker basic authentication.
NOTE: the http://user:password@host
format for basic HTTP auth is not supported.
Contributing
See CONTRIBUTING.md