Skip to content

How to ensure backwards compatibility by tagging pacts

bethesque edited this page Dec 9, 2014 · 6 revisions

If you want to ensure your provider is compatible with both the HEAD version of your consumer, and the PROD version, you can use pact tagging to enable the provider to verify itself against the PROD pact. To read more about this idea, check out this blog post on decoupling the release cycles of your services.

Step 1. Tag the production version of the pact

Step 2. Configure the provider to verify the production pact

  • Add a new pact URL to the verification configuration of your provider project. The new URL will be the same as the normal "latest" url, with the name of the tag appended. eg. http://pact-broker/pacts/provider/Animal%20Service/consumer/Zoo%20App/latest/prod

If you are using Ruby, the provider configuration will look like this.

Pact.service_provider 'Animal Service' do

  honours_pact_with "Zoo App" do
    pact_uri 'http://pact-broker/pacts/provider/Animal%20Service/consumer/Zoo%20App/latest'
  end

  honours_pact_with "Zoo App" do
    pact_uri 'http://pact-broker/pacts/provider/Animal%20Service/consumer/Zoo%20App/latest/prod'
  end

end