Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tier-tomaswalander opened this issue Aug 20, 2019 · 2 comments

Comments

@tier-tomaswalander
Copy link

tier-tomaswalander commented Aug 20, 2019

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
@uglyog
Copy link
Member

uglyog commented Aug 24, 2019

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
}

@tier-tomaswalander
Copy link
Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants