FYI <@U05JJ5KKWHE>, WDYT about a WireMock Dev Serv...
# wiremock-java
o
FYI @Eric Deandrea, WDYT about a WireMock Dev Service? https://github.com/quarkiverse/quarkus-wiremock/issues/58
I mean, technically it is a Dev Service, but not a containerized one
e
Sorry for the delay in getting back to you. I was out on Thanksgiving Holiday. As for a Wiremock dev service I definitely see value in it. I see 2 real uses cases: 1. Running during dev mode. This would be pretty “static”, meaning providing a consistent API for other downstream services the application may talk to. Microcks (https://github.com/microcks/microcks-quarkus) is doing something similar to this. You point it at the other service’s OpenAPI documents (or other artifacts for other types of services) and it will automatically proxy those services. We’re using this today in the Quarkus sample application (https://github.com/quarkusio/quarkus-super-heroes/tree/main/rest-fights#integration-with-microcks) 2. Running when running tests. This could be “static”, like dev mode, but could also be more dynamic. This is where the application would set different responses for different test scenarios within unit/integration tests. We’re doing this today in the Quarkus sample application.
To be honest I didn’t realize there was a quarkus wiremock extension. Looking at the documentation (https://wiremock.org/docs/solutions/quarkus/) I don’t really see a solution for my #2 use case above.
o
Actually it supports Integration tests
I was doing the presentation on the integration on friday, and here is my demo: https://github.com/wiremock/wiremock-quarkus-devservice-demo It works pretty well with @QuarkusTest
e
I see
@ConnectWireMock
in your test, but in the source code for the extension I don’t see that annotation?
oh wait nevermind I found it
its in a separate artifact
o
Yep. Comes from the test jar. It is documented but not 100% trivial. Once we have an official REST API client distribution, it will be easier
e
how would the dev service work if i needed to reconfigure other properties based on the Wiremock url/port? For example, I may need to configure a rest client property, something I would generally do inside a
QuarkusTestResourceLifecycleManager
Does the wiremock extension expose properties that I could read?
o
Right now it is not supported, I submitted a GitHub issue last week. Right now you have to fix the port, because there is no real-time propagation, and it's not something sustainable
e
gotcha
for example, the microcks extension exposes some properties that can be used in the app configuration. Kinda like this: https://github.com/quarkusio/quarkus-super-heroes/blob/main/rest-fights/src/main/resources/application.properties#L41
(something I contributed to that extension 🙂 )
o
Yep. This is what one needs to do with WireMock too
e
but this is definitely a good start
o
So yeah, I might just copy-paste the implementation 🙂 https://github.com/quarkiverse/quarkus-wiremock/issues/68 Actually there is a PR from maintainer now: https://github.com/quarkiverse/quarkus-wiremock/pull/74
🎉 1
Once its a little more stable i can certainly pull this into the sample application
🙌 1
i’d love to get the grpc extension in there too. Right now I’m using something else because verification wasn’t yet there in the wiremock extension
o
Verification means contract testing for the spec, right?
o
Once its a little more stable i can certainly pull this into the sample application
Great! I will keep evolving my example too, because I have a few Quarkus talks submitted
e
although I’m not sure if that PR has made it into a release yet, because I don’t see any updated docs around it on https://wiremock.org/docs/grpc/
i actually did my own PR for that functionality not realizing that Tom had done it too! https://github.com/wiremock/wiremock-grpc-extension/pull/11