-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support for WireMock default instance #19
Comments
If I understand it right, with these enhancements, this library would become a superset of Spring Cloud Contract WireMock and at least initially it wasn't a goal. Why are you migrating from Spring Cloud Contract WireMock when it seems that what it offers fits your needs? |
Mostly because of the smaller footprint of transitive dependencies, kind of related to spring-cloud/spring-cloud-commons#1260 |
Understood. I think we can go this route. What I'm wondering, perhaps Instead of using |
So, if I got it correctly, something like: @SpringBootTest
@ConfigureWireMock // default instance on random port
class MyTests {
...
} but also: @SpringBootTest
@ConfigureWireMock(name = "server1", property = "server1.url")
@ConfigureWireMock(name = "server2", property = "server2.url")
class MyTests {
...
} right? Would this also mean deprecating |
Yes, this is what i have in mind but can't guarantee if this is a good idea without really digging through it. Also, The only utility I still see for |
Would you prefer to look into this topic by yourself or should I give it a try in the upcoming days? I assume you're not in a rush as I was the one asking for it 🙂
In my experience, an extension is invoked only once even when it's registered multiple times. However, with a quick search in the docs, I couldn't find anything official about it – I'll check better and reconfirm. |
Give it a try please. As much as I would like to I am sure I won't have time for it in upcoming weeks. Thank you! |
I opened #34 and #36, I think they are what you want with the last 2 issues in your list. I can also add another issue with Spring Could Contract WireMock is that it uses WireMock 2 and are not in a hurry to use 3.x.y, see spring-cloud/spring-cloud-contract#2092 (comment) This blocks us from using new extensions. |
@maciejwalkowiak do you think you may have time to look at my pr:s? If you can just merge the filesystem mappings, and the port property, that would make our switch to this library much simpler. |
@scordio I think what you are looking for is merged (not yet released). I'll close this issue now and you can try it once we manage to make the first release from Wiremock org... |
Thanks for getting back to me, @tomasbjerre! I'll try out the current build and give feedback. And congrats to @maciejwalkowiak for getting his project into WireMock! |
@tomasbjerre successfully tested and integrated in scordio/spring-batch-notion#25. Thanks! |
I'm looking at how to replace
spring-cloud-contract-wiremock
withwiremock-spring-boot
in one of my projects (scordio/spring-batch-notion#25) and I noticed the configuration becomes a little more verbose.Specifically:
@AutoConfigureWireMock(port = 0)
is replaced by@EnableWireMock(@ConfigureWireMock(name = "wiremock", property = "wiremock.server.url"))
givenThat
were used, I must use instead aWireMockServer
instance injected via@InjectWireMock("wiremock")
In my use case, I don't need custom configurations or the support of multiple instances per test execution, therefore relying on the WireMock default instance would be enough.
I'd like to propose an enhancement where:
@EnableWireMock
without any additional@ConfigureWireMock
sets up the WireMock default instance on a random available portwiremock.server.port
property, mimicking Spring Could Contract WireMock for some convention over configuration@InjectWireMock
(although nothing should prevent its usage)If you agree with the idea, I'll be happy to investigate it.
The text was updated successfully, but these errors were encountered: