HI :slightly_smiling_face: In our scenario, we ha...
# pact-jvm
r
HI 🙂 In our scenario, we have our Pact Broker with the Webhook created (with the new
contract_requiring_verification_published
event), that triggers the needed provider builds once a contract change is detected. As a parameter, it sends the URL of the pact version to verify. Also, in our JVM provider applications so far we have set the consumer version selectors in Gradle, so that the versions to verify are the latests from the main branch and the latests deployed/released. In our case using the workaround
rawjson
, given that the
@ConsumerVersionSelector
annotation didn't support branches or deployments. So my question is how do I let Pact know in my provider code that when the build has been triggered by the Broker, what I need to check is the pact version that the webhook has sent instead of the one defined in the
rawjson
property?
r
Oh, thank you! I missed that one 😅 So if I understand the documentation right, I need to also add
pact.filter.pacturl
and
pact.filter.consumers
the same way I'm adding the others as system properties. My guess is that the
pact.filter.consumers
will always have value (I know its value beforehand), but the
pact.filter.pacturl
will only have a proper value when an actual webhook execution has triggered that provider build. And if that property doesn't have a proper value, then a "normal" build will be executed, using the consumer selector logic that normally applies. Is that right?
u
No, you just need
pact.filter.pacturl
set to the webhook URL.
If you are setting up different tests for different consumers, then you can filter the different tests by consumers so only the one for the correct consumer will run, but I don't recommend that
An, Yes, if the
pact.filter.pacturl
is not set, it will run as normal
r
ahhh, so the
pact.filter.consumers
is helpful then when we have a provider that has many consumers, so that a contract change only triggers the tests of the proper consumer instead of running all the tests with that pactUrl. Makes a lot of sense 🙂
thank you very much!