lars
lars

Reputation: 3

Workflow for Pact Testing in Feature Branches

I'm currently experimenting with Pact and stumbled over a problem with the workflow and can't find a satisfying solution. So hopefully someone can help me. :-)

First of all, that's my current workflow for changes on the consumer side:

  1. The consumer changes are uploaded to Github in a feature branch
  2. Pact tests are run on the CI system and the resulting pact is uploaded to the pact broker with the tags [feature-branch-name] and verify_feature (currently I only use the latter one)
  3. The consumer waits for the verification (using the can-i-deploy tool)
  4. The pact broker triggers the provider via webhook (trigger: contract_content_changed)
  5. The provider runs pact-verify for the latest version tagged verify_feature and uploads the result
  6. The consumer checks the result, if verification was successful the branch can be merged

So far so good. The problem arises when the consumer introduces breaking changes:
After the consumer uploads the changes to Github, the process described above is executed and the provider verification fails which in turn causes the consumer build to fail as expected.

Now the necessary changes are made on the provider side. The provider runs pact-verify against the consumer version of the testing stage and - if successful - the new version is then merged and deployed.

Now the new consumer version should be able to be merged as well. Alas, it does not work, because this version has not been verified again. And when I restart the CI job, the pact is re-uploaded to the pact broker, but since the pact content does not change no webhook is triggered. The consumer version is never verified.

So, what am I doing wrong?

Upvotes: 0

Views: 728

Answers (1)

Beth Skurrie
Beth Skurrie

Reputation: 1318

You need the new WIP pacts feature. It's currently under development, and could be available for beta testing in pact-js (and other languages that wrap the pact-ruby-standalone) within days if you wanted to try it out. If you're using pact-jvm, you'll have to wait a little longer, but we may be able to provide a work around. I've written a blog post on WIP pacts, but haven't published it yet because the feature is not ready for public release. You can find the post here http://blog.pact.io/p/51906e22-ccce-486b-9993-c21794e557d4/ I'd love to get your feedback on it.

Hop on to slack.pact.io and @ me if you'd like to chat further about this.

Upvotes: 0

Related Questions