Closed gleithall closed 1 month ago
VersionedPactUrlLoader was for a specific use, where you have a static URL and just need to replace a version in the URL each time.
The proper way to do it is add @AllowOverridePactUrl
to your test, then set the pact.filter.pacturl
JVM property or environment variable with the URL from the webhook call. That property will need to be set on the test JVM, not the build tool JVM.
Thank you for answering this question, @rholshausen. This makes a lot of sense, so I think this issue can be closed.
I have been trying to create tests to be run when the
contract_requiring_verification_published
event is published by the Pact Broker.I believe I need to create tests that receive information about the specific Pact to be verified, probably the Pact URL.
The
PactUrl
annotation seems to require a hardcoded URL, which won't work for this use case, so I have been looking at theVersionedPactUrl
annotation.From my experiments, and looking at the code, it seems that the
auth
value provided to theVersionedPactUrl
annotation gets ignored by theVersionedPactUrlLoader
.In particular I have tried debugging
auth
value on theVersionedPactUrl
passed here: https://github.com/pact-foundation/pact-jvm/blob/4752365ad30c9ba5640f37578d8b4a7b673d3653/provider/src/main/kotlin/au/com/dius/pact/provider/junitsupport/loader/VersionedPactUrlLoader.kt#L10VersionedPactUrlLoader
calls thePactUrlLoader
, it does not provide a value for theauthentication
argument: compare https://github.com/pact-foundation/pact-jvm/blob/4752365ad30c9ba5640f37578d8b4a7b673d3653/provider/src/main/kotlin/au/com/dius/pact/provider/junitsupport/loader/VersionedPactUrlLoader.kt#L9 with https://github.com/pact-foundation/pact-jvm/blob/4752365ad30c9ba5640f37578d8b4a7b673d3653/provider/src/main/kotlin/au/com/dius/pact/provider/junitsupport/loader/PactUrlLoader.kt#L16I notice that this code was written nearly four years, so I wonder
contract_requiring_verification_published
event?