pact-jvm-provider-junit5 ignorning config for pact.provider.version and pact.verifier.publishResults

Created on 20 Aug 2019  路  2Comments  路  Source: pact-foundation/pact-jvm

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:

  • setting systemProp.pact.provider.version=XXX in gradle.properties
  • setting systemProperty "pact.provider.version", "XXX" in the task in build.gradle
  • setting the property as environment variable (both in IntelliJ and directly in cli and both as pact.provider.version and PACT_PROVIDER_VERSION)
  • running with ./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:

  • Gradle version 5.1.1
  • pact-jvm-provider-junit5_2.12 version 3.5.20

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 systemProperty method on the test configuration:

test {
    systemProperty 'pact.provider.version', project.version
}

All 2 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thombergs picture thombergs  路  3Comments

luvLinux picture luvLinux  路  6Comments

Jejuni picture Jejuni  路  4Comments

audunhalland picture audunhalland  路  4Comments

cah-andrew-fitzgerald picture cah-andrew-fitzgerald  路  5Comments