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

Pacts aren't cached during Gradle 'Test' tasks #1818

Open
zromano opened this issue Aug 19, 2024 · 0 comments
Open

Pacts aren't cached during Gradle 'Test' tasks #1818

zromano opened this issue Aug 19, 2024 · 0 comments

Comments

@zromano
Copy link

zromano commented Aug 19, 2024

When I run my junit tests, they produce pacts under builld/pacts/*.json. I'd expect that if I run ./gradlew --build-cache clean test twice in a row that my pacts would still be there when I pull the test task from the cache.

This currently doesn't happen unless I tell the test task to save the pacts as an output:

outputs.dir("${projectDir}/build/pact-tests")

Repro:

  • Make a Java or Kotlin project with a pact test, Gradle Wrapper + Gradle 8.5, and au.com.dius.pact.consumer:junit5:4.6.7
  • Use the ./gradlew --build-cache clean test command to test your project and generate the pacts under build/pacts
  • Rerun the ./gradlew --build-cache clean test and expect your test results and pacts to be populated from the cache
  • Note that everything is there except the pacts

Expectation:
I'd expect that pacts get cached by default when I use this dependency.

Additionally, if I specify a different output like so:

systemProperty("pact.rootDir", "${projectDir}/build/pact-tests")

I'd expect the results to still be cached by default.

At very least, I think this should be added to the docs

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

1 participant