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

VersionedPactUrlLoader does not seem to support use of Auth #1791

Closed
gleithall opened this issue Apr 26, 2024 · 2 comments
Closed

VersionedPactUrlLoader does not seem to support use of Auth #1791

gleithall opened this issue Apr 26, 2024 · 2 comments
Labels
question Indicates that an issue, pull request, or discussion needs more information

Comments

@gleithall
Copy link

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 the VersionedPactUrl annotation.

From my experiments, and looking at the code, it seems that the auth value provided to the VersionedPactUrl annotation gets ignored by the VersionedPactUrlLoader.

In particular I have tried debugging

I notice that this code was written nearly four years, so I wonder

  • have I misunderstood how this is supposed to work?
  • is there another way that people achieve the goal of handling the contract_requiring_verification_published event?
@rholshausen
Copy link
Contributor

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.

@rholshausen rholshausen added the question Indicates that an issue, pull request, or discussion needs more information label May 3, 2024
@gleithall
Copy link
Author

Thank you for answering this question, @rholshausen. This makes a lot of sense, so I think this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Indicates that an issue, pull request, or discussion needs more information
Projects
None yet
Development

No branches or pull requests

2 participants