maciejwalkowiak / wiremock-spring-boot

WireMock Spring Boot drastically simplifies testing HTTP clients in Spring Boot & Junit 5 based integration tests.
MIT License
218 stars 13 forks source link

Allow injecting port without host/protocol (e.g., for gRPC) #25

Open ipsi opened 7 months ago

ipsi commented 7 months ago

I appreciate how easy this project makes it to configure WireMock for Spring Boot tests, but there's one thing that unfortunately prevented me from adopting it: We have some gRPC services that I would like to mock, with WireMocks gRPC support, but they can't be configured to use an HTTP url. Instead, I'd like to be able to do something like this:

@EnableWireMock({
        @ConfigureWireMock(name = "user-service", portProperty = "user-grpc-client.port", extensions = { new GrpcExtensionFactory() })
})

And then in application-test.yaml, do something like this:

user-grpc-client:
  target: "localhost:${user-grpc-client.port}"
maciejwalkowiak commented 7 months ago

Sounds good! Would you like to contribute a PR?

ipsi commented 7 months ago

Hum. "Like to"? Yes. Willing to deal with the bureaucracy likely required for open-source contributions at $DAYJOB? Not so sure. If I have time, I will have a look at what would be involved, but can't guarantee anything. In turn, of course, I certainly don't expect you to drop everything to add this!