-
Notifications
You must be signed in to change notification settings - Fork 174
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
Use quarkiverse pact extension #212
Conversation
Actually my mistake. Looks like We should also update the documentation for all 3 as well in the contract testing section for each. |
@holly-cummins just to summarize our offline conversation here:
Did I miss anything? |
…ode-guard for consumer tests) I've also switched to the pact extension for rest-heroes.
Thanks for the detailed notes, @edeandrea . All that is now done, and pushed. I didn't squash, to make re-review easier (and because there were relatively few overlapping changes). I’ve updated to switch over the missed module, and also set the dependency scope to However, getting dev mode to work for the consumer tests turned out to be non-trivial. The presence of @testprofile on the consumer tests prevents Pact from working properly. I’ve raised quarkiverse/quarkus-pact#58. Instead of using test profiles, we can just set the pact port to be the same as what’s configured in I tried configuring wire mock to use a static port, and hardcode that same port in the consumer tests, but it didn’t work. The reasons weren’t clear (quarkiverse/quarkus-pact#60). It seems like perhaps the issue isn’t port confusion, and it’s a more fundamental one where any lifecycle or profile interception interfering with pact. The profile issue looks like it will need Pact or Quarkus code changes to resolve, so for the moment I’ve thrown in the towel and re-disabled the consumer tests. This is annoying, but we’ll get there in the end. I implemented a more granular disabling logic, so that the consumer tests won’t run in dev and test modes, but will run in normal mode, without needing to set system properties. I’ve confirmed the tests do run (and are capable of failing) in normal mode. Instead of the annotation, I could have just used the I’ve also removed the junit5-mockito dependency, since nothing seemed to be using it. |
Actually, |
I'll take a peek at the changes in a bit. No worries about squashing - I always squash when I merge and actually prefer multiple commits on a pr. Easier as a dev IMO and easier to review what's changed. Those who say all PRs should only have a single commit - not sure what land they're living in. That's what squashing when merging does :) but alas I digress :) The only reason for the test profile was to re-configure stork to point to the pact mock server rather than wiremock (or the real app port). The pact consumer tests need to run against the pact mock server. I tried at one point to use use a |
.../src/test/java/io/quarkus/sample/superheroes/fight/HeroesVillainsWiremockServerResource.java
Show resolved
Hide resolved
rest-fights/src/test/java/io/quarkus/sample/superheroes/fight/DisableIfContinuousTesting.java
Outdated
Show resolved
Hide resolved
rest-fights/src/test/java/io/quarkus/sample/superheroes/fight/DisableIfContinuousTesting.java
Outdated
Show resolved
Hide resolved
Looks good @holly-cummins ! Once the current checks complete I'm going to update with the base branch & let them re-run. If all goes well I'll merge then. Thank you very much for this! |
Now that there are releases of both the consumer and provider pact extensions, it makes sense to switch the superheroes sample to use them.
For now, the extension just gives feature parity with 'normal' pact, but it will continue to add quarkus joy in subsequent versions. I think the extension will also be needed for Pact to work in Quarkus 3.
Although dev mode doesn't work with the extension (see quarkiverse/quarkus-pact#28), there is a workaround. In the
pom.xml
, changing the scope of the dependency to default (orprovided
) allows continuous testing to work.This workaround might no longer be needed in Quarkus 2.16, although in my local testing it still is. Hopefully it definitely not be needed in Quarkus 3.