👋 Hello, team!
My name is Kamil Rozbicki and I work for Mastercard in Dublin, Ireland.
Oleg Nenashev has pointed me to this group as I was trying to get some advise from him on a challenge I have with the Wiremock.
While trying to find a solution to a challenge I have, I stumbled upon one of the applications Maciej Walkowiak wrote:
He confirmed my impression this would be strictly for @SpringBootTest and would not help with what I want to achieve.
In my team in Mastercard, we are making heavy use of various Microservice API mocks that use Wiremock under the hood. We deploy them to Pivotal Cloud Foundry, as SpringBoot apps, in order to facilitate execution of post-deployment tests on our new microservices, without the need of having their dependant services in place, in the development environment. (Of course, we later integrate these services and do test them together as well).
A while ago, it's become a requirement for us to use mutual-TLS security between our apps, based on server/client policies. This is all proprietary libraries, so won't go much into details.
Long story short: I need to make Wiremock work inside a SpringBoot application, preferably sharing same TCP port (8080). I've used this idea (1st answer):
However, this solution requires disabling Web Application (seting it to 'none'), but this in turn disables our security libraries performing policy-based authorization. Without setting this option to 'none',
I can only make the application to run on 2 separate ports, for example: 8080 for SpringBoot and 8081 for Wiremock, or have 'port in use' exception thrown by Spring Boot on the startup, when I set bot to use same port.
Can you think of any other way to make a Wiremock instance, with all its great functionalities, work inside SpringBoot application, on same port?
Thank you again for your time.
Any help welcomed.
Thank you for pointing me to this direction - will give it a go and message here afterwards.
Sorry for long time it took me to actually try solution you rcommended.
I could not get it to work, and from the context of this document it seems its more about @SpringBootTest, not the @SpringBootApplication
On the examples I see WebEnvironment.NONE being used, which I cannot do - still need Spring Boot Web (on post 8080) and Wiremock, on same port (8080).
Is this possible?
I'm starting to consider adding some programmatic solution for TCP port forwarding proxy, but not sure if it will work, until I try. But know already it would not be pretty.
Any help welcomed.
Thank you for all your time ;)
11/29/2023, 5:51 PM
I’m pretty sure there’s a way to get WireMock to share the same web container as Spring, but I’m not an expert on this module as it’s maintained by the Spring Cloud team.
Might be worth jumping on their one of their support channels and asking if you can’t find the solution in the docs.