pact-foundation / pact_broker

Enables your consumer driven contracts workflow
http://pactflow.io
MIT License
701 stars 171 forks source link

Feature pacts created before the provider branches aren't included in WIP #427

Closed bethesque closed 2 years ago

bethesque commented 3 years ago

I am experiment WIP feature from https://docs.pact.io/pact_broker/advanced_topics/wip_pacts/#technical-details http://blog.pact.io/2020/02/24/introducing-wip-pacts/ And https://docs.pactflow.io/docs/workshops/ci-cd/workshop/verifying-feature-pacts Most of them demonstrate on Provider master branch. It will work because In mature of contract testing, master tag should be already exist. But in our case we want something. Consumer: Checkout c-feat-x branch require API getUser from provider, writing test and publish it with c-feat-x tag Provider: Checkout p-feat-x branch, after implement getUser when verify we want it will verify c-feat-x without modify Verify configuration then we think WIP feature will work so we have pactfoundation/pact-broker:2.79.1.0 running locally and something like this. .... enablePending: true, includeWipPactsSince: "2020-10-31", providerVersion: gitHash, // gitHash is short version 9d76502 providerVersionTags: [gitBranch], // p-feat-x What we expect when run verify: c-feat-x is veified BUT What we got when run verify: c-feat-x is not included in WIP list => it’s not verified Dig more into the docs(https://docs.pact.io/pact_broker/advanced_topics/wip_pacts/#technical-details) we find out at at number 5

  1. Discard all the pacts that were published before the first instance of this provider tag (this is so that if you create a brand new provider branch, you don’t get EVERY head pact included in the WIP pacts list). Yeah it explain why we don’t have c-feat-x in the WIP list because it’s published before first p-feat-x tag created. ==> Now we can understand it but we can not find out our solution for our case (i think that’s is common workflow of dev team).

https://pact-foundation.slack.com/archives/C9VBGLUM9/p1620349213299100

bethesque commented 3 years ago

PR to fix this https://github.com/pact-foundation/pact_broker/pull/432

bethesque commented 2 years ago

Fixed.