@@ -195,59 +195,56 @@ EachLike({
195195For more information see [ Matching] ( https://docs.pact.io/documentation/matching.html )
196196
197197## Verifying Pacts Against a Service
198- > pact-python does not yet have any involvement in the process of verifying a contract against
199- > a provider. This section is included to provide insight into the full cycle of a
200- > contract for those getting started.
201-
202- Like the mock service, the provider verifier can be run in two ways:
203-
204- 1 . [ Install and use it as a Ruby application] [ pact-provider-verifier ]
205- 2 . Run it as a Docker container
206-
207- > Both choices have very similar configuration options. We will illustrate the Docker
208- > method below, but the Ruby method supports the same features.
209-
210- When verifying your contracts, you may find it easier to run the provider application
211- and the verifier in separate Docker containers. This gives you a nice isolated
212- network, where you can set the DNS records of the services to anything you desire
213- and not have to worry about port conflicts with other services on your computer.
214- Launching the provider verifier in a ` docker-compose.yml ` might look like this:
215-
216- ``` yaml
217- version : ' 2'
218- services :
219- app :
220- image : the-provider-application-to-test
221-
222- pactverifier :
223- command : ['tail', '-f', '/dev/null']
224- image : dius/pact-provider-verifier-docker
225- depends_on :
226- - app
227- volumes :
228- - ./contracts:/tmp/pacts
229- environment :
230- - pact_urls=/tmp/pacts/consumer-provider.json
231- - provider_base_url=http://app
232- - provider_states_url=http://app/_pact/provider-states
233- - provider_states_active_url=http://app/_pact/provider-states/active
234- ` ` `
235198
236- In this example, our ` app` container may take a few moments to start, so we don't
237- immediately start running the verification, and instead `tail -f /dev/null` which will keep
238- the container running forever. We can then use `docker-compose` to run the tests like so :
199+ In addition to writing Pacts for Python consumers, you can also verify those Pacts
200+ against a provider of any language. After installing pact-python a ` pact-verifier `
201+ application should be available. To get details about its use you can call it with the
202+ help argument:
239203
204+ ``` bash
205+ pact-verifier --help
240206```
241- docker-compose up -d
242- # Insert code to check that ` app` has finished starting and is ready for requests
243- docker-compose exec pactverifier bundle exec rake verify_pacts
207+
208+ The simplest example is verifying a server with locally stored Pact files and no provider
209+ states:
210+
211+ ``` bash
212+ pact-verifier --provider-base-url=http://localhost:8080 --pact-urls=./pacts/consumer-provider.json
244213```
245214
246- You configure the verifier in Docker using 4 environment variables:
247- - ` pact_urls ` - a comma delimited list of pact file urls
248- - ` provider_base_url ` - the base url of the pact provider
249- - ` provider_states_url ` - the full url of the endpoint which returns provider states by consumer
250- - ` provider_states_active_url ` - the full url of the endpoint which sets the active pact consumer and provider state
215+ Which will immediately invoke the Pact verifier, making HTTP requests to the server located
216+ at ` http://localhost:8080 ` based on the Pacts in ` ./pacts/consumer-provider.json ` and
217+ reporting the results.
218+
219+ There are several options for configuring how the Pacts are verified:
220+
221+ ###### --provider-base-url
222+
223+ Required. Defines the URL of the server to make requests to when verifying the Pacts.
224+
225+ ###### --pact-urls
226+
227+ Required. The location of the Pact files you want to verify. This can be a URL to a [ Pact Broker]
228+ or one or more local paths, separated by a comma.
229+
230+ ###### --provider-states-url
231+
232+ The URL where your provider application will produce the list of available provider states.
233+ The verifier calls this URL to ensure the Pacts specify valid states before making the HTTP
234+ requests.
235+
236+ ###### --provider-states-setup-url
237+
238+ The URL which should be called to setup a specific provider state before a Pact is verified.
239+
240+ ###### --pact-broker-username
241+
242+ The username to use when contacting the Pact Broker.
243+
244+ ###### --pact-broker-password
245+
246+ The password to use when contacting the Pact Broker. You can also specify this value
247+ as the environment variable ` PACT_BROKER_PASSWORD ` .
251248
252249### Provider States
253250In many cases, your contracts will need very specific data to exist on the provider
@@ -301,6 +298,7 @@ End to end: `make e2e`
301298[ bundler ] : http://bundler.io/
302299[ context manager ] : https://en.wikibooks.org/wiki/Python_Programming/Context_Managers
303300[ Pact ] : https://www.gitbook.com/book/pact-foundation/pact/details
301+ [ Pact Broker ] : https://docs.pact.io/documentation/sharings_pacts.html
304302[ Pact documentation ] : https://docs.pact.io/
305303[ Pact Mock Service ] : https://github.com/bethesque/pact-mock_service
306304[ Provider States ] : https://docs.pact.io/documentation/provider_states.html
0 commit comments