Hi, I am trying to implement Pact as contract test...
# general
a
Hi, I am trying to implement Pact as contract testing for our company. Currently I do not understand following: • I have got working test on consumer service and verify on provider service • when consumer service is built and
can-i-deploy
passes new contract is published to pact broker (this is in build pipeline) • this publishes contract e.g.
consumer 1.0 & provider 1.0
◦ when I deploy
consumer 1.1
this will publish contract
consumer 1.1 & provider 1.0
◦ when I deploy
consumer 1.2
this will publish contract
consumer 1.2 & provider 1.0
now my question is if I deploy
provider 1.1
how do I publish new contract between consumer and provider? I guess in this case if we follow the above example if
provider 1.1
is deployed then contract between
consumer 1.2 & provider 1.1
should be published? how do I publish this new contract new consumer builds? or am I missing something?
👋 1
b
You don't get a new contract in that case, the new version of the provider just needs to verify against the same contract party parrot
☝️ 1
It gets more fiddly if you need to also verify old contracts, but that's facilitated with version selectors.
m
I’d like to clarify the use of language here Adam, as it’s important:
when consumer service is built and can-i-deploy passes new contract is published to pact broker (this is in build pipeline)
this publishes contract e.g. consumer 1.0 & provider 1.0
Publishing should happen before running
can-i-deploy
and deployment of code. You should publish on every build, and use branches and releases to document what you are working on, and when you have deployed. You then use consumer version selectors on the provider side, to verify the appropriate contracts.
when I deploy consumer 1.1 this will publish contract consumer 1.1 & provider 1.0
See above. If you deploy a consumer 1.1 that should use the
record-deployment
command. This can only happen after publishing of a contract
when I deploy consumer 1.2 this will publish contract consumer 1.2 & provider 1.0
as per above.
now my question is if I deploy provider 1.1 how do I publish new contract between consumer and provider?
I guess in this case if we follow the above example if provider 1.1 is deployed then contract between consumer 1.2 & provider 1.1 should be published? how do I publish this new contract new consumer builds? or am I missing something?
No, you don’t. The contract is published from the consumer always. The provider verifies the contracts. If there is a new version, you just push the code and let it verify any existing contracts. I’d recommend https://docs.pact.io/pact_nirvana and the CI/CD workshop