We're running our pact provider tests as a separate (custom) gradle task with separate source sets. The contracts are shared and pulled from a pact-broker using the au.com.dius.pact.provider.junit.loader.PactBroker annotation and the verification result is successfully published to the broker (albeit not if the verification fails - but that's a separate concern). However, the provider version is always set to 0.0.0. In the logs I can see: Set the provider version using the 'pact.provider.version' property. Defaulting to '0.0.0'. But setting this system property seems to have no effect. Neither does setting the pact.verifier.publishResults value to false disable the publish verification step.
Some of the things I have tried:
systemProp.pact.provider.version=XXX in gradle.propertiessystemProperty "pact.provider.version", "XXX" in the task in build.gradlepact.provider.version and PACT_PROVIDER_VERSION)./gradlew clean pactProviderTest -Dpact.provider.version=xxx... and a few other similar approaches. E.g., prefixing the value with au.com.dius.. I've also tried to disable the publish step completely by setting that system prop with no luck so far.
Any ideas are welcome! :)
Setup information:
A lot of people have an issue with this. The tests are run as a separate process, and the system properties are not propagated to the test JVM. You need to use the systemProperty method on the test configuration:
test {
systemProperty 'pact.provider.version', project.version
}
@uglyog great thanks for your help!
I could have sworn that I tested this thought. I remember using the systemProperty approach but probably put it in the wrong place.
Anyway, thanks a lot!
Most helpful comment
A lot of people have an issue with this. The tests are run as a separate process, and the system properties are not propagated to the test JVM. You need to use the
systemPropertymethod on the test configuration: